Floating-point multiply-add.
#include <math.h> double fma (x, y, z) double x; double y; double z; float fmaf (x, y, z) float x; float y; float z; long double fmal (x, y, z) long double x; long double y; long double z;
The fma, fmaf, and fmal subroutines compute (x * y) + z, rounded as one ternary operation. They compute the value (as if) to infinite precision and round once to the result format, according to the rounding mode characterized by the value of FLT_ROUNDS.
An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
x | Specifies the value to be multiplied by the y parameter. |
y | Specifies the value to be multiplied by the x parameter. |
z | Specifies the value to be added to the product of the x and y parameters. |
Upon successful completion, the fma, fmaf, and fmal subroutines return (x * y) + z, rounded as one ternary operation.
If x or y are NaN, a NaN is returned.
If x multiplied by y is an exact infinity and z is also an infinity but with the opposite sign, a domain error occurs, and a NaN is returned.
If one of the x and y parameters is infinite, the other is zero, and the z parameter is not a NaN, a domain error occurs, and a NaN is returned.
If one of the x and y parameters is infinite, the other is zero, and z is a NaN, a NaN is returned and a domain error may occur.
If x*y is not 0*Inf nor Inf*0 and z is a NaN, a NaN is returned.
feclearexcept Subroutine and fetestexcept Subroutine
math.h in AIX 5L Version 5.2 Files Reference.