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
1
32
17
Bits 17-32
Bits 1-16
23-bit mantissa
8-bit exponent
1-bit sign (Bit 32)
Least Significant Register
Most 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.38 and the number zero.
9.4.2
Errors in Real Numbers and Operations
Overflow occurs when a number greater than 3.38 or less than -3.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.38) or negative infinity
(for a number less than –3.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
Summary of Contents for VersaMax PLC
Page 16: ...Notes 16 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 38: ...Notes 38 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 50: ...Notes 50 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 92: ...Notes 92 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 112: ...Notes 112 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 224: ...Notes 224 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 292: ...Notes 292 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 316: ...Notes 316 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 317: ......