DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

fma(3M)


fma -- return rounded result of (x × y) + z

Synopsis

   cc [flag ...] file ...  -lm [library ...]
   

#include <math.h>

double fma(double x, double y, double z);

float fmaf(float x, float y, float z);

long double fmal(long double x, long double y, long double z);

Description

fma, fmaf and fmal compute (x × y) + z, rounded as one ternary operation. They value is computed to infinite precision and rounded once to the result format, according to the rounding mode characterized by the value of FLT_ROUNDS.

Errors

If x is ±INFINITY and y is ±0 (or vice versa) and z is not a NaN fma, fmaf and fmal return IEEE NaN on systems that support it and raise the invalid operation exception. Otherwise, they return 0. errno is set to EDOM.

If x × y results in +INFINITY and z is -INFINITY (or vice versa) fma, fmaf and fmal return IEEE NaN on systems that support it and raise the invalid operation exception. Otherwise, they return 0. errno is set to EDOM.

On systems that support IEEE NaN, if the argument to any of these functions is a quiet NaN, that value is returned. If the argument is a signaling NaN, a quiet NaN is returned and the invalid operation exception is raised. In either case, errno is set to EDOM.

If the program was compiled with the -Xt compilation mode, a value that will compare equal to HUGE is returned instead of HUGE_VAL. These error handling procedures may be changed with the function matherr.

References

cc(1)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004