9.4.1 Real Numbers
The REAL data type, which can be used for some Math functions and Numerical
functions, is actually floating point data. Floating-point numbers are stored in single
precision IEEE-standard format. This format requires 32 bits, which occupy two
(adjacent) 16-bit PLC words.
16 132 17
Bits 17-32 Bits 1-16
23-bit mantissa
8-bit exponent
1-bit sign (Bit 32)
Least Significant
RegisterMost Significant
Register
For example, if the floating-point number occupies registers %R0005 and %R0006, then
%R0005 is the least significant register and %R0006 is the most significant register.
The range of numbers that can be stored in this format is from ± 1.401298E–45 to ±
3.402823E+38 and the number zero.
9.4.2 Errors in Real Numbers and Operations
Overflow occurs when a number greater than 3.402823E+38 or less than -3.402823E+38
is generated by a REAL function. The ok output of the function is set OFF; and the result
is set to positive infinity (for a number greater than 3.402823E+38) or negative infinity
(for a number less than –3.402823E+38). You can determine where this occurs by testing
the sense of the ok output.
POS_INF = 7F800000h – IEEE positive infinity representation in hex.
NEG_INF = FF800000h – IEEE negative infinity representation in hex.
If the infinities produced by overflow are used as operands to other REAL functions, they
may cause an undefined result. This result is referred to as NaN (Not a Number). For
example, the result of adding positive infinity to negative infinity is undefined. When the
ADD_REAL function is invoked with positive infinity and negative infinity as its
operands, it produces NaN for its result.
Program Data GFK-1503E User Manual 121
For public disclosure