fplib comparisons between floats and doubles

Table 18 describes routines to perform comparisons between floating-point numbers. See Notes on floating-point comparison routines for more information as indicated in the Notes column.

Table 18. Floating-point comparison routines

FunctionArgument typesReturn typeCondition testedNotes
_fcmpeq2 floatFlags, EQ/NEx equal to ya
_fcmpge2 floatFlags, HS/LOx greater than or equal to ya, b
_fcmple2 floatFlags, HI/LSx less than or equal to ya, b
_feq2 floatBooleanx equal to y-
_fneq2 floatBooleanx not equal to y-
_fgeq2 floatBooleanx greater than or equal to yb
_fgr2 floatBooleanx greater than yb
_fleq2 floatBooleanx less than or equal to yb
_fls2 floatBooleanx less than yb
_dcmpeq2 doubleFlags, EQ/NEx equal to ya
_dcmpge2 doubleFlags, HS/LOx greater than or equal to ya, b
_dcmple2 doubleFlags, HI/LSx less than or equal to ya, b
_deq2 doubleBooleanx equal to y-
_dneq2 doubleBooleanx not equal to y-
_dgeq2 doubleBooleanx greater than or equal to yb
_dgr2 doubleBooleanx greater than yb
_dleq2 doubleBooleanx less than or equal to yb
_dls2 doubleBooleanx less than yb
_fcmp42 floatFlags, VFPx less than or equal to yc
_fcmp4e2 floatFlags, VFPx less than or equal to yb, c
_fdcmp4float, doubleFlags, VFPx less than or equal to yc
_fdcmp4efloat, doubleFlags, VFPx less than or equal to yb, c
_dcmp42 doubleFlags, VFPx less than or equal to yc
_dcmp4e2 doubleFlags, VFPx less than or equal to yb, c
_dfcmp4double, floatFlags, VFPx less than or equal to yc
_dfcmp4edouble, floatFlags, VFPx less than or equal to yb, c

Show/hideNotes on floating-point comparison routines

a

Returns results in the ARM condition flags. This is efficient in assembly language, because you can directly follow a call to the function with a conditional instruction, but it means there is no way to use this function from C. This function is not declared in rt_fp.h.

b

Causes an Invalid Operation exception if either argument is a NaN, even a quiet NaN. Other functions only cause Invalid Operation if an argument is an SNaN. QNaNs return not equal when compared to anything, including other QNaNs (so comparing a QNaN to the same QNaN still returns not equal).

c

Returns VFP-type status flags in the CPSR. Also returns VFP-type status flags in the top four bits of r0, meaning that it is possible to use this function from C. This function is declared in rt_fp.h.

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0475C
Non-ConfidentialID080411