Floating-Point Number Processing Implementation Definition - Epson S5U1C17001C Manual

Cmos 16-bit single chip microcomputer, c compiler package for s1c17 family
Hide thumbs Also See for S5U1C17001C:
Table of Contents

Advertisement

7 liBrary

7.2.3 floating-point number Processing implementation Definition

The following processes are implementation-defined due to C language specifications. The package emulation
library handles them as described below.
floating-point value rounding method
In type conversion from integer type to floating-point type or from one floating-point type to another floating-
point type or in floating-point calculations, if the target value is halfway between two adjacent values
expressible by the intended format, whether the result is rounded to the larger value or smaller value is
implementation-defined.
This package is designed to round values to yield even numbers.
In other words, if the LSB of the value before rounding is 0, no rounding is performed. If the LSB is 1, the
value is rounded up by 1.
Conversion from floating-point type to integer type
In converting a floating-point number to an integral number, the fractional part will be truncated.
Following truncation, the action taken if the original value cannot be expressed in the intended format is
implementation-defined.
・ Conversion from single-/double-precision floating-point type to signed/unsigned long
If the original value is +NaN
If the original value is –NaN
If the original value is too large → Maximum value that can be expressed in the intended format
If the original value is too small → 0x80000000
・ Conversion from single-/double-precision floating-point type to signed/unsigned long long
If the original value is +NaN
If the original value is –NaN
If the original value is too large → 0xffffffff ffffffff
If the original value is too small → 0x1 if the intended format is signed or 0x0 if unsigned
Conversion from one floating-point type to another floating-point type
If the original value cannot be expressed in the intended format in the conversion from one floating-point type
to another floating-point type, the action taken is implementation-defined.
・ Conversion from double-precision floating-point type to single-precision floating-point type
If the original value is +NaN
If the original value is –NaN
If the original value is too large → 0x7f800000 (+∞)
If the original value is too small → 0xff800000 (−∞)
If the original value is too close to 0 (larger than 0) → 0x00000000 (+0)
If the original value is too close to 0 (less than 0)
・ Conversion from single-precision floating-point type to double-precision floating-point type
If the original value is +NaN
If the original value is −NaN
7-6
→ 0x0 if the intended format is signed or 0x80000000 if unsigned
→ 0x0
→ 0x80000000 80000000
→ 0x7fffffff 80000000 if the intended format is signed or 0x0 if
unsigned
→ The significand of the double-precision floating-point number is shifted
two bits to the left and the higher-order 32 bits obtained. If the lower-
order 32 bits of the truncated significand are not 0x0, the LSB of the
32-bit significand is set to 1, and the logical sum of that value and
0x7f900000 is used (+NaN).
→ The significand of the double-precision floating-point number is shifted
two bits to the left and the higher-order 32 bits obtained. If the lower-
order 32 bits of the truncated significand are not 0x0, the LSB of the
32-bit significand is set to 1, and the logical sum of that value and
0xff900000 is used (−NaN).
→ 0x80000000 (−0)
→ The significand of the single-precision floating-point number is
shifted two bits to the right, and the logical sum of that value and
0x7ff80000 00000000 is used.
→ The significand of the single-precision floating-point number is
shifted two bits to the right, and the logical sum of that value and
0xfff80000 00000000 is used.
EPSOn
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
S5U1C17001C ManUal

Advertisement

Table of Contents
loading

Table of Contents