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