
Page 71 of 82
Date: 27.01.06
8.2.2.3
Representation of floating-point values
Floating-point numbers from measurement results are transferred as
4-byte float values as specified in IEEE-754-
1985. The following
examples explain how the 4 bytes are interpreted in order to obtain the
floating-point values.
What components make up a float number?
A floating-point number represented as a 4-byte float value consists of
three elements: the sign bit (
sign
), the exponent (
ex
) and the mantissa
(
mant
).
How is a floating-point number constructed from the three
components?
The number is composed from this formula:
)
0
.
1
(
*
2
*
)
1
(
)
127
(
mant
x
ex
sign
+
−
=
−
Equation 71.1
•
The mantissa is thus saved without the leading “1”,
hence the term (1.0 +
mant
)
•
The exponent is represented with a bias offset,
hence the term (
ex
-127)
Examples:
x = -6.0 is represented as
-1.5 * 2
2
, i.e.
sign bit (
sign
):
1 (negative)
exponent (
ex
):
129
129
– 127 = 2
mantissa (
mant
):
0,5
0,5
+ 1,0
= 1.5
giving:
0
.
6
4
*
5
.
1
5
.
1
*
2
*
)
1
(
)
5
.
0
0
.
1
(
*
2
*
)
1
(
2
)
127
129
(
1
−
=
−
=
−
=
+
−
=
−
x
x = 3.0
is represented as
1.5 * 21 , i.e.
sign bit (
sign
):
0 (positiv)
Exponent (
ex
):
128
128
– 127
= 1
Mantisse (
mant
):
0.5
0.5
+ 1.0
= 1.5
also:
0
.
3
2
*
5
.
1
5
.
1
*
2
*
)
1
(
)
5
.
0
0
.
1
(
*
2
*
)
1
(
1
)
127
128
(
0
=
=
+
=
+
−
=
−
x
x = -2.25 is represented as
-1.125 * 21 , i.e.
sign bit (
sign
):
1 (negative)
exponent (
ex
):
128
28
– 127
= 1
mantissa (
mant
):
0.125
0.125 + 1.0
= 1.125
giving:
25
.
2
2
*
125
.
1
125
.
1
*
2
*
)
1
(
)
125
.
0
0
.
1
(
*
2
*
)
1
(
1
)
127
128
(
1
−
=
−
=
−
=
+
−
=
−
x