5.2.1. Arithmetic on numbers in a particular format

The routines in Table 5.1 perform arithmetic on numbers in a particular format. Arguments and results are always in the same format.

Table 5.1. Arithmetic routines

FunctionArgument typesResult typeOperation
_fadd2 floatfloatReturn x plus y
_fsub2 floatfloatReturn x minus y
_frsb2 floatfloatReturn y minus x
_fmul2 floatfloatReturn x times y
_fdiv2 floatfloatReturn x divided by y
_frdiv2 floatfloatReturn y divided by x
_frem2 floatfloatReturn remainder[1] of x by y
_frndfloatfloatReturn x rounded to an integer[2]
_fsqrtfloatfloatReturn square root of x
_dadd2 doubledoubleReturn x plus y
_dsub2 doubledoubleReturn x minus y
_drsb2 doubledoubleReturn y minus x
_dmul2 doubledoubleReturn x times y
_ddiv2 doubledoubleReturn x divided by y
_drdiv2 doubledoubleReturn y divided by x
_drem2 doubledoubleReturn remaindera of x by y
_drnddoubledoubleReturn x rounded to an integerb
_dsqrtdoubledoubleReturn square root of x

[1] Functions that perform the IEEE 754 remainder operation. This is defined to take two numbers, x and y, and return a number z such 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 above specification gives two acceptable choices of n, the even one is chosen. This behavior occurs independently of the current rounding mode.

[2] 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 5.2

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D