16-bit and 32-bit fixed
point numbers
Fixed point numbers are whole binary numbers with a sign.
Coding of fixed point numbers
Fixed point numbers are 16 bit (= 1 word) or 32 bit (= 2 words) in
binary representation. Bit 15 or bit 31 contains the sign.
••
’0’ = positive number
••
’1’ = negative number
The two’s complement representation is used for negative numbers.
PG input
Input of 16-bit fixed point number data format at the PG:KF
Input of 32-bit fixed point number data format at the PG:DH
Permitted numerical range
16-bit fixed point number
-32768 to +32767 (16 bits)
32-bit fixed point number
-2147483648 to +2147483647 (32 bits)
(8000 0000H to 7FFF FFFFH)
Using fixed point numbers
Use fixed point numbers for simple calculations and for comparing
number values. Since fixed point numbers are always whole numbers,
remember that the result of dividing two fixed point numbers is also a
fixed point number without decimal places.
Floating point numbers
Floating point numbers are positive and negative fractions. They
always occupy a double word (32 bits). A floating point number is
represented as an exponential number. The mantissa is 24 bits long
and the exponent is 8 bits long.
In the CPU 948, the default mantissa is 24 bits long (bits 0 to 23) for
adding, subtracting, multiplying and dividing.
The exponent indicates the order of magnitude of the floating point
number. The sign of the exponent tells you whether the value of the
floating point number is greater or less than 0.1.
STEP 5 Programming Language
CPU 948 Programming Guide
C79000-G8576-C848-04
2 - 9
Summary of Contents for CPU 948
Page 10: ...Contents CPU 948 Programming Guide 1 2 C79000 G8576 C848 04 ...
Page 32: ...Contents CPU 948 Programming Guide 2 2 C79000 G8576 C848 04 ...
Page 72: ...Data Blocks CPU 948 Programming Guide 2 42 C79000 G8576 C848 04 ...
Page 74: ...Contents CPU 948 Programming Guide 3 2 C79000 G8576 C848 04 ...
Page 154: ...Contents CPU 948 Programming Guide 4 2 C79000 G8576 C848 04 ...
Page 200: ...Contents CPU 948 Programming Guide 5 2 C79000 G8576 C848 04 ...
Page 308: ...Contents CPU 948 Programming Guide 7 2 C79000 G8576 C848 04 ...
Page 324: ...Examples of Parameter Assignment CPU 948 Programming Guide 7 18 C79000 G8576 C848 04 ...
Page 326: ...Contents CPU 948 Programming Guide 8 2 C79000 G8576 C848 04 ...
Page 370: ...Addressable System Data Area CPU 948 Programming Guide 8 46 C79000 G8576 C848 04 ...
Page 372: ...Contents CPU 948 Programming Guide 9 2 C79000 G8576 C848 04 ...
Page 486: ...Contents CPU 948 Programming Guide 11 2 C79000 G8576 C848 04 ...
Page 522: ...PG Functions via the S5 Bus CPU 948 Programming Guide 11 38 C79000 G8576 C848 04 ...
Page 524: ...Contents CPU 948 Programming Guide 12 2 C79000 G8576 C848 04 ...
Page 538: ...Contents CPU 948 Programming Guide 13 2 C79000 G8576 C848 04 ...
Page 546: ...List of Key Words CPU 948 Programming Guide Index 6 C79000 G8576 C848 04 ...