beautypg.com

2 instructions, Floating-point arithmetic results – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 267

background image

2-231

2 Instructions

CP1E CPU Unit Instructions Reference Manual(W483)

F
loat
ing
-p
o

int
Math

In

stru

ctio

ns

2

(2) Non-normalized Numbers

Non-normalized numbers express real numbers with very small absolute values. The sign bit will be 0
for a positive number and 1 for a negative number.

The exponent (e) will be 0, and the real exponent will be –126.

The mantissa (f) will be expressed from 1 to 2

33

– 1, and it is assume that, in the real mantissa, bit 2

33

is 0 and the binary point follows immediately after it.

Non-normalized numbers are expressed as follows:

(–1)

(sign s)

Ч 2

–126

Ч (mantissa x 2

–23

)

Example

Sign:

Exponent:

–126

Mantissa:

0 + (2

22

+ 2

21

)

× 2

23

= 0 + (2

1

+ 2

2

) = 0 + 0.75 = 0.75

Value:

–0.75

× 2

126

(3) Zero

Values of +0.0 and –0.0 can be expressed by setting the sign to 0 for positive or 1 for negative. The
exponent and mantissa will both be 0. Both +0.0 and –0.0 are equivalent to 0.0. Refer to Floating-point
Arithmetic Results, below, for differences produced by the sign of 0.0.

(4) Infinity

Values of +

∞ and –∞ can be expressed by setting the sign to 0 for positive or 1 for negative. The expo-

nent will be 255 (2

8

– 1) and the mantissa will be 0.

(5) NaN

NaN (not a number) is produced when the result of calculations, such as 0.0/0.0,

∞/∞, or ∞–∞, does not

correspond to a number or infinity. The exponent will be 255 (2

8

– 1) and the mantissa will be not 0.

Note There are no specifications for the sign of NaN or the value of the mantissa field (other than to be not 0).

Floating-point Arithmetic Results

(1) Rounding Results

The following methods will be used to round results when the number of digits in the accurate result of
floating-point arithmetic exceeds the significant digits of internal processing expressions.

If the result is close to one of two internal floating-point expressions, the closer expression will be used.

If the result is midway between two internal floating-point expressions, the result will be rounded so that
the last digit of the mantissa is 0.

(2) Overflows, Underflows, and Illegal Calculations

Overflows will be output as either positive or negative infinity, depending on the sign of the result.
Underflows will be output as either positive or negative zero, depending on the sign of the result.

Illegal calculations will result in NaN. Illegal calculations include adding infinity to a number with the
opposite sign, subtracting infinity from a number with the opposite sign, multiplying zero and infinity,
dividing zero by zero, or dividing infinity by infinity.

The value of the result may not be correct if an overflow occurs when converting a floating-point number
to an integer.

0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

31 30

23 22

0

This manual is related to the following products: