E

Values of Floating-Point Numbers

Use the following table to calculate the value of a floating-point number from the binary number stored in two registers.

Exponent (e)

Mantissa (f)

Value of Floating Point Number

 

 

 

 

 

 

255

Non-zero

Not a valid number (NaN).

 

 

 

255

0

–1s*

0 < e < 255

Any value

–1s* 2e–127* 1.f

0

Non-zero

–1s* 2–126* 0.f

0

0

0

 

 

 

f = the mantissa. The mantissa is a binary fraction.

e= the exponent. The exponent is an integer E such that E+127 is the power of 2 by which the mantissa must be multiplied to yield the floating-point value.

s

=

the sign bit.

*

=

the multiplication operator.

For example, consider the floating-point number 12.5. The IEEE floating-point binary representation of the number is:

01000001 01001000 00000000 00000000

or 41480000 hex in hexadecimal form. The most significant bit (the sign bit) is zero (s=0). The next eight most significant bits are 10000010, or 130 decimal (e=130).

The mantissa is stored as a decimal binary number with the decimal point preceding the most significant of the 23 bits. Thus, the most significant bit in the mantissa is a multiple of 2–1, the next most significant bit is a multiple of 2–2, and so on to the least significant bit, which is a multiple of

2–23. The final 23 bits (the mantissa) are:

1001000 00000000 00000000

The value of the mantissa, then, is .5625 (that is, 2–1+ 2–4).

Since e > 0 and e < 255, we use the third formula in the table above:

number = –1s* 2e–127* 1.f

=–10* 2130–127* 1.5625

=1 * 23 * 1.5625

=8 * 1.5625

=12.5

Thus, you can see that the above binary representation is correct.

The range of numbers that can be stored in this format is from ± 1.401298E–45 to

± 3.402823E+38 and the number zero.

E-4

Series 90-30/20/Micro Programmable Controllers Reference Manual–September 1998

GFK-0467K

Page 299
Image 299
GE 90-30/20/Micro manual Values of Floating-Point Numbers, Exponent e Mantissa f Value of Floating Point Number