- 19 -
the power parameters are watts etc.
What is a floating point Number?
A floating-point number is a number with two parts, a mantissa and an exponent and is written
in the form 1.234 x 10
5
. The mantissa (1.234 in this example) must have the decimal point
moved to the right with the number of places determined by the exponent (5 places in this
example) i.e. 1.234x 10
5
= 123400. If the exponent is negative the decimal point is moved to
the left.
What is an IEEE 754 format floating-point number?
An IEEE 754 floating point number is the binary equivalent of the decimal floating-point
number shown above. The major difference being that the most significant bit of the mantissa
is always arranged to be 1 and is thus not needed in the representation of the number. The
process by which the most significant bit is arranged to be 1 is called normalization, the
mantissa is thus referred to as a “normal mantissa”. During normalization the bits in the
mantissa are shifted to the left whilst the exponent is decremented until the most significant bit
of the mantissa is one. In the special case where the number is zero both mantissa and
exponent are zero.
The bits in an IEEE 754 format have the following significance:
Data Hi Reg,
Hi Byte.
Data Hi Reg,
Lo Byte.
Data Lo Reg,
Hi Byte.
Data Lo Reg,
Lo Byte.
SEEE
EEEE
EMMM
MMMM
MMMM
MMMM
MMMM
MMMM
Where:
S represents the sign bit where 1 is negative and 0 is positive
E is the 8-bit exponent with an offset of 127 i.e. an exponent of zero is represented by 127, an
exponent of 1 by 128 etc.
M is the 23-bit normal mantissa. The 24th bit is always 1 and, therefore, is not stored.
Using the above format the floating point number 240.5 is represented as 43708000 hex:
Data Hi Reg,
Hi Byte
Data Hi Reg,
Lo Byte
Data Lo Reg,
Hi Byte
Data Lo Reg,
Lo Byte
43
70
80
00
The following example demonstrates how to convert IEEE 754 floating-point numbers from
their hexadecimal form to decimal form. For this example, we will use the value for 240.5
shown above
Note that the floating-point storage representation is not an intuitive format. To convert this
value to decimal, the bits should be separated as specified in the floating-point number storage
format table shown above.
For example:
www.stromzähler.eu