HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)

f
fma(3M) fma(3M)
(Itanium(R)-based System Only)
NAME
fma(), fmaf( ), fmaw( ), fmal(), fmaq() - floating multiply-add functions
SYNOPSIS
#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);
extended fmaw(extended x, extended y, extended z);
quad fmaq(quad x, quad y, quad z);
DESCRIPTION
fma() returns (x*y)+z, rounded as one ternary operation: it computes the value (as if) to infinite preci-
sion and rounds once to the result format, according to the current rounding mode.
fmaf() is a float version of fma(); it takes float arguments and returns a float result.
fmal() is a long double version of fma(); it takes long double arguments and returns a
long
double
result.
fmaw() is an extended version of fma(); it takes extended arguments and returns an extended
result.
fmaq() is equivalent to fmal() on HP-UX systems.
The FP_FAST_FMA , FP_FAST_FMAF , and FP_FAST_FMAW macros are defined in <math.h>, indicat-
ing that
fma(), fmaf(), and fmaw() are each as fast as a multiply and add.
USAGE
These functions are available only for Itanium-based systems.
To use these functions, compile either with the default -Ae option or with the -Aa
and
-D_HPUX_SOURCE options.
To use fmaw() or fmaq(), compile also with the -fpwidetypes option.
To use these functions, make sure your program includes <math.h>. Link in the math library by specify-
ing -lm on the compiler or linker command line.
RETURN VALUE
If one of x and y is infinite, the other is zero, and z is a NaN,
fma() returns NaN and optionally raises the
invalid exception.
If one of x and y is infinite, the other is zero, and z is not a NaN,
fma() returns NaN and raises the invalid
exception.
If x times y is an exact infinity and z is also an infinity but with the opposite sign,
fma() returns NaN and
raises the invalid exception.
fma() returns a properly signed infinity in lieu of a value whose magnitude is too large, and raise the
overflow and inexact exceptions.
fma() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal or zero)
and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.
fma() raises the inexact exception whenever a rounded result does not equal the mathematical result.
ERRORS
No errors are defined.
SEE ALSO
math(5).
STANDARDS CONFORMANCE
fma(), fmaf(), fmal() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)
432 Hewlett-Packard Company 1 HP-UX 11i Version 2: December 2007 Update