DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

fma(S)


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

Syntax

   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.

See also

cc(CP), math(M)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003