1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\" Distributed under GPL, 2002-07-27 Walter Harms
5 .\" Modified 2004-11-15, Added further text on FLT_ROUNDS
6 .\" as suggested by AEB and Fabian Kreutz
8 .TH FMA 3 2010-09-20 "" "Linux Programmer's Manual"
10 fma, fmaf, fmal \- floating-point multiply and add
15 .BI "double fma(double " x ", double " y ", double " z );
17 .BI "float fmaf(float " x ", float " y ", float " z );
19 .BI "long double fmal(long double " x ", long double " y ", long double " z );
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
34 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
35 _POSIX_C_SOURCE\ >=\ 200112L;
45 .IR x " * " y " + " z .
46 The result is rounded as one ternary operation according to the
47 current rounding mode (see
50 These functions return the value of
51 .IR x " * " y " + " z ,
52 rounded as one ternary operation.
58 is a NaN, a NaN is returned.
64 is an exact infinity, and
66 is an infinity with the opposite sign,
67 a domain error occurs,
68 and a NaN is returned.
70 .\" POSIX.1-2008 allows some possible differences for the following two
71 .\" domain error cases, but on Linux they are treated the same (AFAICS).
72 .\" Nevertheless, we'll mirror POSIX.1 and describe the two cases
78 is an infinity, the other is 0, and
81 a domain error occurs, and
83 .\" POSIX.1 says that a NaN or an implementation-defined value shall
84 .\" be returned for this case.
90 is an infinity, and the other is 0, and
93 .\" POSIX.1 makes the domain error optional for this case.
94 a domain error occurs, and
101 is not an infinity times zero (or vice versa), and
106 If the result overflows,
107 a range error occurs, and
108 an infinity with the correct sign is returned.
110 If the result underflows,
111 a range error occurs, and
112 a signed 0 is returned.
116 for information on how to determine whether an error has occurred
117 when calling these functions.
119 The following errors can occur:
121 Domain error: \fIx\fP * \fIy\fP + \fIz\fP, \
122 or \fIx\fP * \fIy\fP is invalid and \fIz\fP is not a NaN
126 An invalid floating-point exception
130 Range error: result overflow
134 An overflow floating-point exception
138 Range error: result underflow
142 An underflow floating-point exception
146 These functions do not set
148 .\" FIXME . Is it intentional that these functions do not set errno?
149 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6801
151 These functions first appeared in glibc in version 2.1.