Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > F

fma(3M)

HP Integrity Server Only
HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

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 precision 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>, indicating that fma(), fmaf(), and fmaw() are each as fast as a multiply and add.

USAGE

These functions are available only for Integrity servers.

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 specifying -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'')

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.