B.2 ibm format – Siemens 500 NIM User Manual

Page 125

Advertising
background image

Floating Point Numbers

B-3

SIMATIC TIWAY I Series 500 NIM User Manual

B.2

IBM Format

Floating point numbers are stored in memory in two 16-bit words as
illustrated in Figure B-1. Before being stored in memory, however, the
number is converted to a normalized hexadecimal fraction, a corresponding
hexadecimal exponent, and a sign bit.

The fraction portion of the IBM number is normalized; that is, it is shifted
to the left to eliminate leading zeros between the radix point and the first
signficant bit. Each bit position shift in the normalization process produces
a corresponding change in the exponent portion of the number which
maintains the correct magnitude of the number. When the number is
completely normalized, the IBM hexadecimal fraction is stored in bits 8
through 15 of the first memory word, and in all 16 bits of the second
memory word. The radix point for the fraction is assumed to be positioned
between bits 7 and 8 of the first memory word (at the start of the
hexadecimal fraction).

The exponent portion of the number is biased by 40

16 (excess 64 notation),

so that the exponent for 16

) is represented in memory by 4016. Positive

exponents are represented by numbers greater than 40

16, and negative

exponents are represented by numbers less than 40

16. For example, 16! is

represented in the exponent field by the value 41

16. The exponents may be

any value from 00

16 to 7F16; including the 4016 bias value, these

numbers represent exponent values from –40

16 to +3F16 (16^$ to 16@#).

The seven exponent bits are stored in bits 1 through 7 of the first memory
word.

Bit 0 of the first memory word is used for a sign bit. When this bit is zero,
the number is positive. When this bit is one, the number is negative.

Advertising