fctidz
Floating Convert to Integer Doubleword with Round to Zero
Converts Double to 64-bit Int (Truncate).
Details
The fctidz instruction converts a double-precision floating-point value to a signed 64-bit integer, rounding towards zero. If the source value is NaN, it returns 0x8000_0000_0000_0000 and sets VXCVI to 1. If the rounded value exceeds the range of a 64-bit signed integer, it saturates to either 0x7FFF_FFFF_FFFF_FFFF or 0x8000_0000_0000_0000.
Pseudocode Operation
if src is NaN then
result ← 0x8000_0000_0000_0000
VXCVI ← 1
if src is SNaN then
VXSNAN ← 1
else
rounded_value ← round_towards_zero(src)
if rounded_value > 2^63 - 1 then
result ← 0x7FFF_FFFF_FFFF_FFFF
VXCVI ← 1
else if rounded_value < -2^63 then
result ← 0x8000_0000_0000_0000
VXCVI ← 1
else
result ← convert_to_signed_integer(rounded_value)
XX ← 1 if result is inexact
if no Invalid Operation Exception occurs then
FRT ← result
Programming Note
The fctidz instruction converts a double-precision floating-point value to a signed 64-bit integer, rounding towards zero. If the source value is NaN, it returns 0x8000_0000_0000_0000 and sets VXCVI to 1. If the rounded value exceeds the range of a 64-bit signed integer, it saturates to either 0x7FFF_FFFF_FFFF_FFFF or 0x8000_0000_0000_0000.
Example
Encoding
Operands
-
FRT
Target -
FRB
Source