Datasheet

Floating-point Support
5-4 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
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
Function Argument types Result type Operation
_fadd
2
float float
Return x plus y
_fsub
2
float float
Return x minus y
_frsb
2
float float
Return y minus x
_fmul
2
float float
Return x times y
_fdiv
2
float float
Return x divided by y
_frdiv
2
float float
Return y divided by x
_frem
2
float float
Return remainder
a
of x by y
_frnd float float
Return x rounded to an integer
b
_fsqrt float float
Return square root of x
_dadd
2
double double
Return x plus y
_dsub
2
double double
Return x minus y
_drsb
2
double double
Return y minus x
_dmul
2
double double
Return x times y
_ddiv
2
double double
Return x divided by y
_drdiv
2
double double
Return y divided by x
_drem
2
double double
Return remainder
a
of x by y
_drnd double double
Return x rounded to an integer
b
_dsqrt double double
Return square root of x
a. 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.
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 5-2 on page 5-5