Keil Logo Arm Logo

Technical Support

On-Line Manuals

Libraries and Floating Point Support Guide

Conventions and feedback The ARM C and C++ libraries The ARM C micro-library Floating-point support About floating-point support The software floating-point library, fplib Calling fplib routines fplib arithmetic on numbers in a particular format fplib conversions between floats, doubles, and int fplib conversion between long longs, floats, and d fplib comparisons between floats and doubles fplib C99 functions Controlling the ARM floating-point environment Floating-point functions for compatibility with Mi C99-compatible functions for controlling the ARM f C99 rounding mode and floating-point exception mac Exception flag handling Functions for handling rounding modes Functions for saving and restoring the whole float Functions for temporarily disabling exceptions ARM floating-point compiler extensions to the C99 Writing a custom exception trap handler Example of a custom exception handler Exception trap handling by signals Using C99 signalling NaNs provided by mathlib (_WA mathlib double and single-precision floating-point Nonstandard functions in mathlib IEEE 754 arithmetic Basic data types for IEEE 754 arithmetic Single precision data type for IEEE 754 arithmetic Double precision data type for IEEE 754 arithmetic Sample single precision floating-point values for Sample double precision floating-point values for IEEE 754 arithmetic and rounding Exceptions arising from IEEE 754 floating-point ar Ignoring exceptions from IEEE 754 floating-point a Trapping exceptions from IEEE 754 floating-point a Exception types recognized by the ARM floating-poi Using the Vector Floating-Point (VFP) support libr

fplib comparisons between floats and doubles

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.

Copyright © 2007-2008, 2011-2012 ARM. All rights reserved.ARM DUI 0378D
Non-ConfidentialID062912

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.