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

Libraries and Floating Point Support Guide

fplib arithmetic on numbers in a particular format

fplib arithmetic on numbers in a particular format

Table 15 describes routines to perform arithmetic on numbers in a particular format. Arguments and return types are always in the same format.

Table 15. Arithmetic routines

FunctionArgument typesReturn typeOperation
__aeabi_fadd2 floatfloatReturn x plus y
__aeabi_fsub2 floatfloatReturn x minus y
__aeabi_frsub2 floatfloatReturn y minus x
__aeabi_fmul2 floatfloatReturn x times y
__aeabi_fdiv2 floatfloatReturn x divided by y
_frdiv2 floatfloatReturn y divided by x
_frem2 floatfloatReturn remainder of x by y (see a in Notes on arithmetic routines)
_frndfloatfloatReturn x rounded to an integer (see b in Notes on arithmetic routines)
_fsqrtfloatfloatReturn square root of x
__aeabi_dadd2 doubledoubleReturn x plus y
__aeabi_dsub2 doubledoubleReturn x minus y
__aeabi_drsub2 doubledoubleReturn y minus x
__aeabi_dmul2 doubledoubleReturn x times y
__aeabi_ddiv2 doubledoubleReturn x divided by y
_drdiv2 doubledoubleReturn y divided by x
_drem2 doubledoubleReturn remainder of x by y (see a and c in Notes on arithmetic routines)
_drnddoubledoubleReturn x rounded to an integer (see b in Notes on arithmetic routines)
_dsqrtdoubledoubleReturn square root of x

Show/hideNotes on arithmetic routines

a

Functions that perform the IEEE 754 remainder operation. This is defined to take two numbers, x and y, and return a number z so that z = x - n * y, where n is an integer. To return an exactly correct result, n is chosen so that z is no bigger than half of x (so that z might be negative even if both x and y are positive). The IEEE 754 remainder function is not the same as the operation performed by the C library function fmod, where z always has the same sign as x. Where the IEEE 754 specification gives two acceptable choices of n, the even one is chosen. This behavior occurs independently of the current rounding mode.

b

Functions that perform the IEEE 754 round-to-integer operation. This takes a number and rounds it to an integer (in accordance with the current rounding mode), but returns that integer in the floating-point number format rather than as a C int variable. To convert a number to an int variable, you must use the _ffix routines described in Table 16.

c

The IEEE 754 remainder() function is a synonym for _drem. remainder() is defined in math.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.