
Appendix
Page 36
Version FELD-V2002.02
PROFIBUS manual
7.
Appendix A: 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 36.1
The mantissa is 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 * 2
1
, i.e.
sign bit (
sign
):
0 (positive)
exponent (
ex
):
128
Æ
128 – 127 = 1
mantissa (
mant
): 0.5
Æ
0.5 + 1.0 = 1.5
giving:
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 * 2
1
, i.e.
sign bit (
sign
):
1 (negative)
exponent (
ex
):
128
Æ
128 – 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