1FMA(3)                     Linux Programmer's Manual                    FMA(3)
2
3
4

NAME

6       fma, fmaf, fmal - floating-point multiply and add
7

SYNOPSIS

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(): _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or
20       cc -std=c99
21

DESCRIPTION

23       The fma() function computes x * y + z.  The result is  rounded  as  one
24       ternary operation according to the current rounding mode (see fenv(3)).
25

RETURN VALUE

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

ERRORS

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

VERSIONS

68       These functions first appeared in glibc in version 2.1.
69

CONFORMING TO

71       C99, POSIX.1-2001.
72

SEE ALSO

74       remainder(3), remquo(3)
75

COLOPHON

77       This  page  is  part of release 3.25 of the Linux man-pages project.  A
78       description of the project, and information about reporting  bugs,  can
79       be found at http://www.kernel.org/doc/man-pages/.
80
81
82
83                                  2008-10-06                            FMA(3)
Impressum