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>
5 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
6 .\" Distributed under GPL
9 .\" Modified 2004-11-15, Added further text on FLT_ROUNDS
10 .\" as suggested by AEB and Fabian Kreutz
12 .TH FMA 3 2015-03-02 "" "Linux Programmer's Manual"
14 fma, fmaf, fmal \- floating-point multiply and add
19 .BI "double fma(double " x ", double " y ", double " z );
21 .BI "float fmaf(float " x ", float " y ", float " z );
23 .BI "long double fmal(long double " x ", long double " y ", long double " z );
29 Feature Test Macro Requirements for glibc (see
30 .BR feature_test_macros (7)):
38 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
39 _POSIX_C_SOURCE\ >=\ 200112L;
46 These functions compute
47 .IR x " * " y " + " z .
48 The result is rounded as one ternary operation according to the
49 current rounding mode (see
52 These functions return the value of
53 .IR x " * " y " + " z ,
54 rounded as one ternary operation.
60 is a NaN, a NaN is returned.
66 is an exact infinity, and
68 is an infinity with the opposite sign,
69 a domain error occurs,
70 and a NaN is returned.
72 .\" POSIX.1-2008 allows some possible differences for the following two
73 .\" domain error cases, but on Linux they are treated the same (AFAICS).
74 .\" Nevertheless, we'll mirror POSIX.1 and describe the two cases
80 is an infinity, the other is 0, and
83 a domain error occurs, and
85 .\" POSIX.1 says that a NaN or an implementation-defined value shall
86 .\" be returned for this case.
92 is an infinity, and the other is 0, and
95 .\" POSIX.1 makes the domain error optional for this case.
96 a domain error occurs, and
103 is not an infinity times zero (or vice versa), and
108 If the result overflows,
109 a range error occurs, and
110 an infinity with the correct sign is returned.
112 If the result underflows,
113 a range error occurs, and
114 a signed 0 is returned.
118 for information on how to determine whether an error has occurred
119 when calling these functions.
121 The following errors can occur:
123 Domain error: \fIx\fP * \fIy\fP + \fIz\fP, \
124 or \fIx\fP * \fIy\fP is invalid and \fIz\fP is not a NaN
128 An invalid floating-point exception
132 Range error: result overflow
136 An overflow floating-point exception
140 Range error: result underflow
144 An underflow floating-point exception
148 These functions do not set
150 .\" FIXME . Is it intentional that these functions do not set errno?
151 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6801
153 These functions first appeared in glibc in version 2.1.
155 For an explanation of the terms used in this section, see
161 Interface Attribute Value
166 T} Thread safety MT-Safe
169 C99, POSIX.1-2001, POSIX.1-2008.