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 2013-09-17 "" "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;
49 .IR x " * " y " + " z .
50 The result is rounded as one ternary operation according to the
51 current rounding mode (see
54 These functions return the value of
55 .IR x " * " y " + " z ,
56 rounded as one ternary operation.
62 is a NaN, a NaN is returned.
68 is an exact infinity, and
70 is an infinity with the opposite sign,
71 a domain error occurs,
72 and a NaN is returned.
74 .\" POSIX.1-2008 allows some possible differences for the following two
75 .\" domain error cases, but on Linux they are treated the same (AFAICS).
76 .\" Nevertheless, we'll mirror POSIX.1 and describe the two cases
82 is an infinity, the other is 0, and
85 a domain error occurs, and
87 .\" POSIX.1 says that a NaN or an implementation-defined value shall
88 .\" be returned for this case.
94 is an infinity, and the other is 0, and
97 .\" POSIX.1 makes the domain error optional for this case.
98 a domain error occurs, and
105 is not an infinity times zero (or vice versa), and
110 If the result overflows,
111 a range error occurs, and
112 an infinity with the correct sign is returned.
114 If the result underflows,
115 a range error occurs, and
116 a signed 0 is returned.
120 for information on how to determine whether an error has occurred
121 when calling these functions.
123 The following errors can occur:
125 Domain error: \fIx\fP * \fIy\fP + \fIz\fP, \
126 or \fIx\fP * \fIy\fP is invalid and \fIz\fP is not a NaN
130 An invalid floating-point exception
134 Range error: result overflow
138 An overflow floating-point exception
142 Range error: result underflow
146 An underflow floating-point exception
150 These functions do not set
152 .\" FIXME . Is it intentional that these functions do not set errno?
153 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6801
155 These functions first appeared in glibc in version 2.1.
157 .SS Multithreading (see pthreads(7))
163 functions are thread-safe.
170 This page is part of release 3.67 of the Linux
173 A description of the project,
174 information about reporting bugs,
175 and the latest version of this page,
177 \%http://www.kernel.org/doc/man\-pages/.