![background image](http://html1.mh-extra.com/html/omron/sysmac-cs1d-cpu/sysmac-cs1d-cpu_reference-manual_742268632.webp)
593
Floating-point Math Instructions
Section 3-15
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.
Infinity
Values of +
∞
and –
∞
can be expressed by setting the sign to 0 for positive or 1
for negative. The exponent will be 255 (2
8
– 1) and the mantissa will be 0.
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
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.
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 convert-
ing a floating-point number to an integer.
Precautions in Handling
Special Values
The following precautions apply to handling zero, infinity, and NaN.
• The sum of positive zero and negative zero is positive zero.
• The difference between zeros of the same sign is positive zero.
• If any operand is a NaN, the results will be a NaN.
• Positive zero and negative zero are treated as equivalent in comparisons.
• Comparison or equivalency tests on one or more NaN will always be true
for != and always be false for all other instructions.
Floating-point Calculation Results
When the absolute value of the result is greater than the maximum value that
can be expressed for floating-point data, the Overflow Flag will turn ON and
the result will be output as
±∞
. If the result is positive, it will be output as +
∞
; if
negative, then –
∞
.
The Equals Flag will only turn ON when both the exponent (e) and the man-
tissa (f) are zero after a calculation. A calculation result will also be output as
zero when the absolute value of the result is less than the minimum value that
can be expressed for floating-point data. In that case the Underflow Flag will
turn ON.
Example
In this program example, the X-axis and Y-axis coordinates (x, y) are provided
by 4-digit BCD content of D00000 and D00001. The distance (r) from the ori-
Содержание SYSMAC CS1D-CPU**
Страница 3: ...iv...
Страница 29: ...xxx...
Страница 185: ...146 List of Instructions by Function Code Section 2 4...
Страница 193: ...154 3 35 4 MOVE BIT MOVBC 568 1274 3 35 5 BIT COUNTER BCNTC 621 1276 3 35 6 GET VARIABLE ID GETID 286 1278...
Страница 1389: ...1350 CJ series Instruction Execution Times and Number of Steps Section 4 2...
Страница 1390: ...1351 Appendix A ASCII Code Table ASCII SP Four leftmost bits Four rightmost bits...
Страница 1391: ...1352 ASCII Code Table Appendix A...