Real Numbers; Errors In Real Numbers And Operations - GE VersaMax PLC User Manual

Table of Contents

Advertisement

Most Significant Register
32
Program Data
For public disclosure

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.
Bits 17-32
8-bit exponent
1-bit sign (Bit 32)
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
NEG_INF
= FF800000h
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.
Least Significant Register
Bits 1-16
17
16
23-bit mantissa
– IEEE positive infinity representation in hex.
– IEEE negative infinity representation in hex.
1
GFK-1503E User Manual 121

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents