Typ zmiennoprzecinkowy

15 września 2013 | LoadingDodaj do biblioteki

Floating point describes a method of representing an approximation of a real number. The numbers are, in general, represented approximately to a fixed number of significant digits (the mantissa) and scaled using an exponent. The base for the scaling is normally 2, 10 or 16. The typical number that can be represented exactly is of the form: significant digits × baseexponent.
Typ zmiennoprzecinkowy - ilustracja dzieci skaczą przez krzak
The term floating point refers to the fact that a number’s radix point (decimal point, or, more commonly in computers, binary point) can "float"; that is, it can be placed anywhere relative to the significant digits of the number. This position is indicated as the exponent component in the internal representation, and floating point can thus be thought of as a computer realization of scientific notation.

The speed of floating-point operations, commonly referred to in performance measurements as FLOPS, is an important characteristic of a computer system.


A number representation specifies some way of storing a number that may be encoded as a string of digits. The arithmetic is defined as a set of actions on the representation that simulate classical arithmetic operations.

There are several mechanisms by which strings of digits can represent numbers. In common mathematical notation, the digit string can be of any length, and the location of the radix point is indicated by placing an explicit „point” character (dot or comma) there. If the radix point is not specified then it is implicitly assumed to lie at the right (least significant) end of the string (that is, the number is an integer).

In scientific notation, the given number is scaled by a power of 10 so that it lies within a certain range — typically between 1 and 10, with the radix point appearing immediately after the first digit. The scaling factor, as a power of ten, is then indicated separately at the end of the number. For example, the revolution period of Jupiter’s moon Io is 152853.5047 seconds, a value that would be represented in standard-form scientific notation as 1.528535047×105 seconds.

Floating-point representation is similar in concept to scientific notation. Logically, a floating-point number consists of:

  • A signed (meaning positive or negative) digit string of a given length in a given base (or radix). This digit string is referred to as the significand, coefficient or, less often, the mantissa. The length of the significand determines the precision to which numbers can be represented. The radix point position is assumed to always be somewhere within the significand — often just after or just before the most significant digit, or to the right of the rightmost (least significant) digit.
  • A signed integer exponent, also referred to as the characteristic or scale, which modifies the magnitude of the number.

To derive the value of the floating-point number, one must multiply the significand by the base raised to the power of the exponent, equivalent to shifting the radix point from its implied position by a number of places equal to the value of the exponent — to the right if the exponent is positive or to the left if the exponent is negative.
Ilustracja float mantysa wykładnik cecha
Using base-10 (the familiar decimal notation) as an example, the number 152853.5047, which has ten decimal digits of precision, is represented as the significand 1.528535047 together with an exponent of 5 (if the implied position of the radix point is after the first most significant digit, here 1). To determine the actual value, a decimal point is placed after the first digit of the significand and the result is multiplied by 105 to give 1.528535047 × 105, or 152853.5047. In storing such a number, the base (10) need not be stored, since it will be the same for the entire range of supported numbers, and can thus be inferred.

As far as internal representation is concerned, floating-point numbers are typically packed into a computer datum as the sign bit, the exponent field, and the significand (mantissa), from left to right.

IEEE 754: floating point in modern computers

The standard of computer representation for binary floating-point numbers is IEEE 754 (aka. IEC 60559). This standard is followed by almost all modern machines. The standard provides for many closely related formats, differing in only a few details. Three of these are especially widely used in computer hardware and languages:

  • Single precision, called „float” in the C language family. This is a binary format that occupies 32 bits (4 bytes).
  • Double precision, called „double” in the C language family. This is a binary format that occupies 64 bits (8 bytes).
  • Double extended, also called „extended precision” format. This is a binary format that occupies at least 79 bits (80 if the hidden/implicit bit rule is not used).

Special values

Signed zero

In the IEEE 754 standard, zero is signed, meaning that there exist both a „positive zero” (+0) and a „negative zero” (−0). The two values behave as equal in numerical comparisons, but some operations return different results for +0 and −0. For instance, 1/(−0) returns negative infinity, while 1/+0 returns positive infinity.


The infinities can be represented in IEEE floating-point datatypes, just like ordinary floating-point values like 1, 1.5, etc. They are not error values in any way.


IEEE 754 specifies a special value called „Not a Number” (NaN) to be returned as the result of certain „invalid” operations, such as 0/0, ∞×0, or sqrt(−1).


Rounding is used when the exact result of a floating-point operation would need more digits than there are digits in the significand. IEEE 754 requires correct rounding: that is, the rounded result is as if infinitely precise arithmetic was used to compute the value and then rounded.

There are several different rounding schemes (or rounding modes). Historically, truncation was the typical approach. Since the introduction of IEEE 754, the default method (round to nearest, ties to even, sometimes called Banker’s Rounding) is more commonly used. This method rounds the ideal (infinitely precise) result of an arithmetic operation to the nearest representable value, and gives that representation as the result. In the case of a tie, the value that would make the significand end in an even digit is chosen.

Źródło: Wikipedia (tekst został dostosowany do potrzeb kursu)


a characteristic of sth.
cecha czegoś
a method of representing sth.
metoda reprezentowania czegoś
also known as (zwany również…)
an action on
działanie na
an approximation of sth.
przybliżenie czegoś
arithmetic operation
działanie arytmetyczne
as far as x is concerned
jeśli chodzi o x, co do x
przyjmować, zakładać
Banker’s rounding
zaokrąglanie bankowe
binary point
„przecinek dwójkowy”
computer system
system komputerowy
decimal point
punkt dziesiętny (w języku angielskim i programowaniu jest to kropka dziesiętna, ale np. w języku polskim jest to przecinek dziesiętny)
double precision
podwójna precyzja
encode as
zakodować jako/w formie
equal to the value of x
równy wartości x
especially widely used in
szczególnie powszechnie używany w
extended precision
rozszerzona precyzja
floating point
zmiennoprzecinkowy, zmiennopozycyjny
floating-point number
liczba zmiennoprzecinkowa
floating-point operation
działanie zmiennoprzecinkowe
Floating point Operations Per Second (liczba działań zmiennoprzecinkowych na sekundę)
International Electrotechnical Commission (Międzynarodowa Komisja Elektrotechniczna)
Institute of Electrical and Electronics Engineers (Instytut Inżynierów Elektryków i Elektroników)
indicate sth. by
oznaczyć/wskazać coś poprzez
dedukować, wnioskować
infinitely precise arithmetic
arytmetyka nieskończonej precyzji
niepoprawny, nieprawidłowy
pierwszy z lewej
rząd wielkości
mathematical notation
notacja matematyczna
not a number (nie liczba)
negative infinity
ujemna nieskończoność
negative zero
zero ujemne
number representation
reprezentacja liczbowa
numerical comparison
porównywanie liczb
of any length
dowolnej długości
of the form
w postaci
performance measurement
pomiar wydajności

positive infinity
dodatnia nieskończoność
positive zero
zero dodatnie
radix point
kropka pozycyjna
real number
liczba rzeczywista
pierwszy od prawej
round to nearest, ties to even
zaokrąglenie do najbliższej całkowitej parzystej
rounding mode
sposób zaokrąglania, metoda zaokrąglania
rounding scheme
sposób zaokrąglania, metoda zaokrąglania
scale by a power of 10
przeskalować o potęgę 10
scaling factor
współczynnik skalowania
scientific notation
notacja naukowa
scientific notation
notacja naukowa
signed zero
zero ze znakiem
ze znakiem
significant digit
cyfra znacząca
similar in concept to
podobny koncepcyjnie do
since the introduction of x
od wprowadzenia x
single precision
pojedyncza precyzja
sth. can be thought of as…
można coś traktować jak…
the location of sth.
lokalizacja czegoś
the speed of sth.
szybkość czegoś
the standard of x
standard x
the term x refers to
pojęcie x odnosi się do
the two values behave as equal
te dwie wartości są równoznaczne
this standard is followed by
standardu tego przestrzega/standard ten jest przestrzegany w
to define as
zdefiniować jako/w formie
to derive
to determine the value of sth.
aby określić wartość czegoś
to determine
to float
to give x as the result
zwrócić x w wyniku
to give
dać w wyniku
to indicate
wskazywać, wyznaczać
to place sth. relative to sth.
ustalić położenie czegoś względem czegoś
to raise to the power of
podnieść do potęgi
to represent exactly
reprezentować dokładnie, w sposób precyzyjny
to represent sth. approximately to sth.
reprezentować coś w przybliżeniu do czegoś
to round to the nearest
zaokrąglić do najbliższej
to scale
to shift
obcięcie, skrócenie
way of storing
sposób przechowywania
within a certain range
w określonym zakresie


  1. Provide Polish equivalents of these terms and expressions
  2. Provide English equivalents of these terms and expressions
  3. Answer the following questions
  4. Provide words for the definitions
  5. Fill in the gaps
  6. Translate the words in brackets into English
  7. Fill in the gaps
  8. Translate these sentences into English

Grammar corner

0 conditional

The zero conditional is used to talk about general truths, i.e. facts that are always true, like scientific facts. The zero conditional is formed by using the present simple in both clauses:

if + simple present + simple present

[1] If the radix point is not specified then it is implicitly assumed to lie at the right end of the string.

[2] Subnormal numbers ensure that for finite floating-point numbers x and y, x – y == 0 if and only if x == y.

[3] If there is not an exact representation then the conversion requires a choice of which floating-point number to use to represent the original value.

In the sentence [1] the verb to be is used twice in the present simple form, is not and is.

In the sentence [2] there is a special type of conditional expressed in mathematical notation. The chunk x – y == 0 if and only if x == y can be read as, "x minus y equals zero if and only if x equals y".

Sentence [3] contains the verb to be and the verb require in the present simple form, is not and requires.

Exercise: Choose the correct answer.

Licencja: CC-BY-SA 3.0


Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *