fabs

Floating Absolute Value

fabs FRT, FRB

Computes absolute value of a float.

Encoding

Binary Layout
63
0:5
FRT
6:10
0
11:15
FRB
16:20
264
21:30
/
31
 
Format X-form
Opcode 0xFC000210
Extension Floating-Point

Operands

  • FRT
    Target
  • FRB
    Source

Example

fabs f1, f3

Registers Altered

FPSCR

Related

More in Floating-Point

Reference

Description

Computes the absolute value of a double-precision floating-point number in FRB and places the result in FRT. The sign bit is cleared while all other bits remain unchanged. No exception flags are set.

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.