Keil Logo

Technical Support

On-Line Manuals

Libraries and Floating Point Support Guide

Preface 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, long longs, doub 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 mathlib double and single-precision floating-point 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 Exception types recognized by the ARM floating-poi Using the Vector Floating-Point (VFP) support libr The C and C++ Library Functions reference Floating-point Support Functions Reference

fplib comparisons between floats and doubles

3.2.4 fplib comparisons between floats and doubles

fplib provides a number of routines to perform comparisons between floating-point numbers.

The following table describes these routines.

Table 3-3 Floating-point comparison routines

Function Argument types Return type Condition tested Notes
_fcmpeq 2 float Flags, EQ/NE x equal to y a
_fcmpge 2 float Flags, HS/LO x greater than or equal to y a, b
_fcmple 2 float Flags, HI/LS x less than or equal to y a, b
_feq 2 float Boolean x equal to y -
_fneq 2 float Boolean x not equal to y -
_fgeq 2 float Boolean x greater than or equal to y b
_fgr 2 float Boolean x greater than y b
_fleq 2 float Boolean x less than or equal to y b
_fls 2 float Boolean x less than y b
_dcmpeq 2 double Flags, EQ/NE x equal to y a
_dcmpge 2 double Flags, HS/LO x greater than or equal to y a, b
_dcmple 2 double Flags, HI/LS x less than or equal to y a, b
_deq 2 double Boolean x equal to y -
_dneq 2 double Boolean x not equal to y -
_dgeq 2 double Boolean x greater than or equal to y b
_dgr 2 double Boolean x greater than y b
_dleq 2 double Boolean x less than or equal to y b
_dls 2 double Boolean x less than y b
_fcmp4 2 float Flags, VFP x less than or equal to y c
_fcmp4e 2 float Flags, VFP x less than or equal to y b, c
_fdcmp4 float, double Flags, VFP x less than or equal to y c
_fdcmp4e float, double Flags, VFP x less than or equal to y b, c
_dcmp4 2 double Flags, VFP x less than or equal to y c
_dcmp4e 2 double Flags, VFP x less than or equal to y b, c
_dfcmp4 double, float Flags, VFP x less than or equal to y c
_dfcmp4e double, float Flags, VFP x less than or equal to y b, c

Notes 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 PSR. 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.
Non-ConfidentialPDF file icon PDF versionARM DUI0378H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  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.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.