ftsqrt
Float Test for Square Root
ftsqrt BF, FRB
Tests for conditions that would cause a sqrt exception.
Details
The ftsqrt instruction tests the square root of a floating-point operand in register FRB and sets flags based on certain conditions.
Pseudocode Operation
Let e_b be the unbiased exponent of the double-precision floating-point operand in register FRB.
fe_flag is set to 1 if either of the following conditions occurs:
• The double-precision floating-point operand in register FRB is a zero, a NaN, or an infinity, or a negative value.
• e_b is less than or equal to -970.
fg_flag is set to 1 if the following condition occurs:
• The double-precision floating-point operand in register FRB is a Zero, an Infinity, or a denormalized value.
Programming Note
The ftsqrt instruction is useful for checking special conditions of a floating-point number before performing square root operations. It sets the FE flag if the operand is zero, NaN, infinity, negative, or has an exponent less than or equal to -970. The FG flag is set if the operand is zero, infinity, or denormalized. Ensure the operand is properly aligned and in double-precision format to avoid unexpected results.
Example
ftsqrt cr0, f3
Encoding
Binary Layout
63
0
BF
6
/
9
0
11
FRB
16
160
21
/
31
Operands
-
BF
CR Field -
FRB
Source