1FMA(3) Linux Programmer's Manual FMA(3)
2
3
4
6 fma, fmaf, fmal - floating-point multiply and add
7
9 #include <math.h>
10
11 double fma(double x, double y, double z);
12 float fmaf(float x, float y, float z);
13 long double fmal(long double x, long double y, long double z);
14
15 Link with -lm.
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 fma(), fmaf(), fmal():
20 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21
23 These functions compute x * y + z. The result is rounded as one
24 ternary operation according to the current rounding mode (see fenv(3)).
25
27 These functions return the value of x * y + z, rounded as one ternary
28 operation.
29
30 If x or y is a NaN, a NaN is returned.
31
32 If x times y is an exact infinity, and z is an infinity with the oppo‐
33 site sign, a domain error occurs, and a NaN is returned.
34
35 If one of x or y is an infinity, the other is 0, and z is not a NaN, a
36 domain error occurs, and a NaN is returned.
37
38 If one of x or y is an infinity, and the other is 0, and z is a NaN, a
39 domain error occurs, and a NaN is returned.
40
41 If x times y is not an infinity times zero (or vice versa), and z is a
42 NaN, a NaN is returned.
43
44 If the result overflows, a range error occurs, and an infinity with the
45 correct sign is returned.
46
47 If the result underflows, a range error occurs, and a signed 0 is
48 returned.
49
51 See math_error(7) for information on how to determine whether an error
52 has occurred when calling these functions.
53
54 The following errors can occur:
55
56 Domain error: x * y + z, or x * y is invalid and z is not a NaN
57 An invalid floating-point exception (FE_INVALID) is raised.
58
59 Range error: result overflow
60 An overflow floating-point exception (FE_OVERFLOW) is raised.
61
62 Range error: result underflow
63 An underflow floating-point exception (FE_UNDERFLOW) is raised.
64
65 These functions do not set errno.
66
68 These functions first appeared in glibc in version 2.1.
69
71 For an explanation of the terms used in this section, see
72 attributes(7).
73
74 ┌──────────────────────┬───────────────┬─────────┐
75 │Interface │ Attribute │ Value │
76 ├──────────────────────┼───────────────┼─────────┤
77 │fma(), fmaf(), fmal() │ Thread safety │ MT-Safe │
78 └──────────────────────┴───────────────┴─────────┘
80 C99, POSIX.1-2001, POSIX.1-2008.
81
83 remainder(3), remquo(3)
84
86 This page is part of release 4.15 of the Linux man-pages project. A
87 description of the project, information about reporting bugs, and the
88 latest version of this page, can be found at
89 https://www.kernel.org/doc/man-pages/.
90
91
92
93 2017-09-15 FMA(3)