]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fma.3
man*/: ffix (un-bracket tables)
[thirdparty/man-pages.git] / man3 / fma.3
CommitLineData
a1eaacb1 1'\" t
fea681da 2.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
6bd01965
MK
3.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4.\" <mtk.manpages@gmail.com>
2297bf0e 5.\"
95fb8859 6.\" SPDX-License-Identifier: GPL-1.0-or-later
0389adc9 7.\"
4022b76e
MK
8.\" Modified 2004-11-15, Added further text on FLT_ROUNDS
9.\" as suggested by AEB and Fabian Kreutz
fea681da 10.\"
4c1c5274 11.TH fma 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
12.SH NAME
13fma, fmaf, fmal \- floating-point multiply and add
2af19291
AC
14.SH LIBRARY
15Math library
8fc3b2cf 16.RI ( libm ", " \-lm )
fea681da
MK
17.SH SYNOPSIS
18.nf
19.B #include <math.h>
68e4db0a 20.PP
fea681da 21.BI "double fma(double " x ", double " y ", double " z );
fea681da 22.BI "float fmaf(float " x ", float " y ", float " z );
fea681da
MK
23.BI "long double fmal(long double " x ", long double " y ", long double " z );
24.fi
68e4db0a 25.PP
d39ad78f 26.RS -4
6bd01965
MK
27Feature Test Macro Requirements for glibc (see
28.BR feature_test_macros (7)):
d39ad78f 29.RE
68e4db0a 30.PP
6bd01965
MK
31.BR fma (),
32.BR fmaf (),
33.BR fmal ():
9d2adbae 34.nf
5c10d2c5 35 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae 36.fi
fea681da 37.SH DESCRIPTION
5600f73a 38These functions compute
fea681da 39.IR x " * " y " + " z .
6bd01965 40The result is rounded as one ternary operation according to the
00b5d372
MK
41current rounding mode (see
42.BR fenv (3)).
6bd01965
MK
43.SH RETURN VALUE
44These functions return the value of
45.IR x " * " y " + " z ,
46rounded as one ternary operation.
847e0d88 47.PP
6bd01965
MK
48If
49.I x
50or
51.I y
52is a NaN, a NaN is returned.
847e0d88 53.PP
6bd01965
MK
54If
55.I x
56times
57.I y
58is an exact infinity, and
59.I z
60is an infinity with the opposite sign,
efe294cb 61a domain error occurs,
6bd01965 62and a NaN is returned.
847e0d88 63.PP
c42ad30f
MK
64.\" POSIX.1-2008 allows some possible differences for the following two
65.\" domain error cases, but on Linux they are treated the same (AFAICS).
66.\" Nevertheless, we'll mirror POSIX.1 and describe the two cases
67.\" separately.
6bd01965
MK
68If one of
69.I x
70or
71.I y
72is an infinity, the other is 0, and
73.I z
74is not a NaN,
efe294cb 75a domain error occurs, and
6bd01965 76a NaN is returned.
c42ad30f
MK
77.\" POSIX.1 says that a NaN or an implementation-defined value shall
78.\" be returned for this case.
847e0d88 79.PP
6bd01965
MK
80If one of
81.I x
82or
83.I y
84is an infinity, and the other is 0, and
85.I z
86is a NaN,
87.\" POSIX.1 makes the domain error optional for this case.
efe294cb 88a domain error occurs, and
6bd01965 89a NaN is returned.
847e0d88 90.PP
6bd01965
MK
91If
92.I x
93times
94.I y
385cf745 95is not an infinity times zero (or vice versa), and
6bd01965
MK
96.I z
97is a NaN,
98a NaN is returned.
847e0d88 99.PP
6bd01965 100If the result overflows,
efe294cb 101a range error occurs, and
6bd01965 102an infinity with the correct sign is returned.
847e0d88 103.PP
6bd01965 104If the result underflows,
efe294cb 105a range error occurs, and
6bd01965
MK
106a signed 0 is returned.
107.SH ERRORS
108See
109.BR math_error (7)
110for information on how to determine whether an error has occurred
111when calling these functions.
112.PP
113The following errors can occur:
114.TP
115Domain error: \fIx\fP * \fIy\fP + \fIz\fP, \
116or \fIx\fP * \fIy\fP is invalid and \fIz\fP is not a NaN
117.\" .I errno
118.\" is set to
119.\" .BR EDOM .
120An invalid floating-point exception
121.RB ( FE_INVALID )
122is raised.
123.TP
124Range error: result overflow
125.\" .I errno
126.\" is set to
127.\" .BR ERANGE .
128An overflow floating-point exception
129.RB ( FE_OVERFLOW )
130is raised.
131.TP
132Range error: result underflow
133.\" .I errno
134.\" is set to
135.\" .BR ERANGE .
136An underflow floating-point exception
137.RB ( FE_UNDERFLOW )
138is raised.
139.PP
140These functions do not set
141.IR errno .
142.\" FIXME . Is it intentional that these functions do not set errno?
fd00f831 143.\" Bug raised: https://www.sourceware.org/bugzilla/show_bug.cgi?id=6801
cc610618 144.SH ATTRIBUTES
d2d44c15
MK
145For an explanation of the terms used in this section, see
146.BR attributes (7).
147.TS
148allbox;
c466875e 149lbx lb lb
d2d44c15
MK
150l l l.
151Interface Attribute Value
152T{
9e54434e
BR
153.na
154.nh
cc610618
PH
155.BR fma (),
156.BR fmaf (),
cc610618 157.BR fmal ()
d2d44c15
MK
158T} Thread safety MT-Safe
159.TE
c466875e 160.sp 1
3113c7f3 161.SH STANDARDS
4131356c
AC
162C11, POSIX.1-2008.
163.SH HISTORY
164glibc 2.1.
165C99, POSIX.1-2001.
47297adb 166.SH SEE ALSO
fea681da
MK
167.BR remainder (3),
168.BR remquo (3)