### 4.1.2. Arithmetic on numbers in a particular format

Table 4.1 describes routines to perform arithmetic on numbers in a particular format. Arguments and results are always in the same format.

Table 4.1. Arithmetic routines

FunctionArgument typesResult typeOperation
`__aeabi_fadd`2 floatfloatReturn x plus y
`__aeabi_fsub`2 floatfloatReturn x minus y
`__aeabi_frsub`2 floatfloatReturn y minus x
`__aeabi_fmul`2 floatfloatReturn x times y
`__aeabi_fdiv`2 floatfloatReturn x divided by y
`_frdiv`2 floatfloatReturn y divided by x
`_frem`2 floatfloatReturn remainder of x by y (see a in Notes on arithmetic routines)
`_frnd`floatfloatReturn x rounded to an integer (see b in Notes on arithmetic routines)
`_fsqrt`floatfloatReturn square root of x
`__aeabi_dadd`2 doubledoubleReturn x plus y
`__aeabi_dsub`2 doubledoubleReturn x minus y
`__aeabi_drsub`2 doubledoubleReturn y minus x
`__aeabi_dmul`2 doubledoubleReturn x times y
`__aeabi_ddiv`2 doubledoubleReturn x divided by y
`_drdiv`2 doubledoubleReturn y divided by x
`_drem`2 doubledoubleReturn remainder of x by y (see a in Notes on arithmetic routines)
`_drnd`doubledoubleReturn x rounded to an integer (see b in Notes on arithmetic routines)
`_dsqrt`doubledoubleReturn square root of x

#### Notes 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 4.2