fabs
Floating Absolute Value
fabs FRT, FRB
Computes absolute value of a float.
Details
The fabs instruction computes the absolute value of a floating-point number. It sets the sign bit of the result to zero, effectively removing any negative sign from the operand.
Pseudocode Operation
FRT ← abs(FRB)
Programming Note
The fabs instruction is commonly used when you need to ensure that a floating-point number is positive without altering its magnitude. Be cautious with NaN (Not-a-Number) values, as fabs will return a quiet NaN if the input is a signaling NaN. This instruction operates at user privilege level and does not raise exceptions for normal inputs; however, it respects the rounding mode set in the FPSCR register.
Example
fabs f1, f3
Encoding
Binary Layout
63
0
FRT
6
0
11
FRB
16
264
21
/
31
Operands
-
FRT
Target -
FRB
Source