| |||
| Home > VFP Exception Handling > Arithmetic exceptions > FTOUI, FTOUIZ, FTOSI, and FTOSIZ | |||
Float-to-integer conversions generate Invalid Operation exceptions rather than Overflow or Underflow exceptions. To support signed conversions with round-towards-zero rounding in the maximum range possible for C, C++, and Java compiled code, the thresholds for pessimistic bouncing are different for the various rounding modes.
Table 23.12 and Table 23.13 use the following notation:
In the VFP Response column, the response notations are:
These input values are bounced for all rounding modes.
These input values are bounced for signed conversions in all rounding modes.
These input values are bounced for signed conversions in all rounding modes except round-towards-zero.
These input values are bounced for unsigned conversions in all rounding modes.
These input values are bounced for unsigned conversions in all rounding modes except round-towards-zero.
In the Unsigned results and Signed results columns, the rounding mode notations are:
Round-to-nearest mode.
Round-towards-plus-infinity mode.
Round-towards-minus infinity mode.
Round-towards-zero mode.
Table 23.12 shows the single-precision float-to-integer bounce range and the results returned for exceptional conditions. The exponent values shown in Table 23.12 are in biased format.
Table 23.12. Single-precision float-to-integer bounce thresholds and stored results
| Floating-point value | Integer value | Unsigned result | Status | Signed result | Status | VFP11 response |
|---|---|---|---|---|---|---|
| NaN | - | 0x00000000 | Invalid | 0x00000000 | Invalid | Bounce all |
0x7F800000 | +infinity | 0xFFFFFFFF | Invalid | 0x7FFFFFFF | Invalid | Bounce all |
| +maximum SP[1] to 232 |
| Invalid | 0x7FFFFFFF | Invalid | Bounce all |
| 232 - 28 to 231 |
| Valid | 0x7FFFFFFF | Invalid | Bounce S UnZ |
| 231 - 27 to 230 |
| Valid |
| Valid | Bounce SnZ |
| 230 - 26 to +0 |
| Valid |
| Valid | No bounce |
| -0 to -230 + 26 |
| Invalid[2] |
| Valid | Bounce U |
| -230 to -231 +27 | 0x00000000 | Invalid |
| Valid | Bounce U |
0xCF000000 | -231 | 0x00000000 | Invalid | 0x80000000 | Valid | Bounce U SnZ |
| -231 to -maximum SP | 0x00000000 | Invalid | 0x80000000 | Invalid | Bounce all |
0xFF800000 | -infinity | 0x00000000 | Invalid | 0x80000000 | Invalid | Bounce all |
[1] SP = single-precision. [2] A negative input value that rounds to a zero result returns zero and is not invalid. | ||||||
Table 23.13 shows the double-precision float-to-integer bounce range and the results returned for exceptional conditions.
Table 23.13. Double-precision float-to-integer bounce thresholds and stored results
| Floating-point value | Integer value | Unsigned result | Status | Signed result | Status | VFP11 response |
|---|---|---|---|---|---|---|
| NaN | - | 0x00000000 | Invalid | 0x00000000 | Invalid | Bounce all |
0x7FF00000 00000000 | +infinity | 0xFFFFFFFF | Invalid | 0x7FFFFFFF | Invalid | Bounce all |
| +max DP[1] to 232 | 0xFFFFFFFF | Invalid | 0x7FFFFFFF | Invalid | Bounce all |
| 232 - 221 to 232 - 2-1 |
| Invalid Valid | 0x7FFFFFFF | Invalid | Bounce S UnZ |
| 232 - 2-1 - 221 to 232 - 20 + 2-21 |
| Invalid Valid | 0x7FFFFFFF | Invalid | Bounce S UnZ |
| 232 - 20 to 231 |
| Valid | 0x7FFFFFFF | Invalid | Bounce S UnZ |
| 231 - 222 to 231 - 2-1 |
| Valid Valid |
| Invalid Valid | Bounce SnZ |
| 231 - 2-1 - 2-22 to 231 - 20 + 2-22 |
| Valid Valid |
| Invalid Valid | Bounce SnZ |
| 231 - 20 to 230 |
| Valid Valid |
| Valid Valid | Bounce SnZ |
| 230 - 223 to +0 |
| Valid Valid Valid |
| Valid Valid Valid | Bounce none |
| -0 to -230 + 2-23 | 0x00000000[2] | Invalid |
| Valid Valid Valid | Bounce U |
| -230 to -231 + 2-22 | 0x00000000 | Invalid |
| Valid Valid Valid | Bounce U |
0xC1E00000 00000000 | -231 | 0x00000000 | Invalid | 0x80000000 | Valid | Bounce U SnZ |
| -231 - 2-21 to -231 - 2-1 | 0x00000000 | Invalid |
| Valid Invalid | Bounce U SnZ |
| -231 - 2-1 - 2-21 to 231 - 20 + 2-21 |
| Invalid |
| Valid Invalid | Bounce U SnZ |
| 231 - 20 to -max DP [1] | 0x00000000 | Invalid | 0x80000000 | Invalid | Bounce all |
0xFFF00000 00000000 | -infinity | 0x00000000 | Invalid | 0x00000000 | Invalid | Bounce all |
[1] max DP = maximum double-precision. [2] A negative input value that rounds to a zero result returns zero and is not invalid. | ||||||