]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/expm1.3
Many pages: Fix style issues reported by `make lint-groff`
[thirdparty/man-pages.git] / man3 / expm1.3
1 .\" Copyright 1995 Jim Van Zandt <jrv@vanzandt.mv.com>
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .\" Modified 2002-07-27 Walter Harms
8 .\" (walter.harms@informatik.uni-oldenburg.de)
9 .\"
10 .TH EXPM1 3 2021-03-22 GNU "Linux Programmer's Manual"
11 .SH NAME
12 expm1, expm1f, expm1l \- exponential minus 1
13 .SH LIBRARY
14 Math library
15 .RI ( libm ", " \-lm )
16 .SH SYNOPSIS
17 .nf
18 .B #include <math.h>
19 .PP
20 .BI "double expm1(double " x );
21 .BI "float expm1f(float " x );
22 .BI "long double expm1l(long double " x );
23 .PP
24 .fi
25 .RS -4
26 Feature Test Macro Requirements for glibc (see
27 .BR feature_test_macros (7)):
28 .RE
29 .PP
30 .BR expm1 ():
31 .nf
32 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
33 || _XOPEN_SOURCE >= 500
34 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
35 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
36 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
37 .fi
38 .PP
39 .BR expm1f (),
40 .BR expm1l ():
41 .nf
42 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
43 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
44 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
45 .fi
46 .SH DESCRIPTION
47 These functions return a value equivalent to
48 .PP
49 .nf
50 exp(x) \- 1
51 .fi
52 .PP
53 The result is computed in a way that is accurate even if the value of
54 .I x
55 is near
56 zero\(ema case where
57 .I "exp(x) \- 1"
58 would be inaccurate due to
59 subtraction of two numbers that are nearly equal.
60 .SH RETURN VALUE
61 On success, these functions return
62 .IR "exp(x)\ \-\ 1" .
63 .PP
64 If
65 .I x
66 is a NaN,
67 a NaN is returned.
68 .PP
69 If
70 .I x
71 is +0 (\-0),
72 +0 (\-0) is returned.
73 .PP
74 If
75 .I x
76 is positive infinity, positive infinity is returned.
77 .PP
78 If
79 .I x
80 is negative infinity, \-1 is returned.
81 .PP
82 If the result overflows, a range error occurs,
83 and the functions return
84 .RB \- HUGE_VAL ,
85 .RB \- HUGE_VALF ,
86 or
87 .RB \- HUGE_VALL ,
88 respectively.
89 .SH ERRORS
90 See
91 .BR math_error (7)
92 for information on how to determine whether an error has occurred
93 when calling these functions.
94 .PP
95 The following errors can occur:
96 .TP
97 Range error, overflow
98 .I errno
99 is set to
100 .B ERANGE
101 (but see BUGS).
102 An overflow floating-point exception
103 .RB ( FE_OVERFLOW )
104 is raised.
105 .\"
106 .\" POSIX.1 specifies an optional range error (underflow) if
107 .\" x is subnormal. Glibc does not implement this.
108 .SH ATTRIBUTES
109 For an explanation of the terms used in this section, see
110 .BR attributes (7).
111 .ad l
112 .nh
113 .TS
114 allbox;
115 lbx lb lb
116 l l l.
117 Interface Attribute Value
118 T{
119 .BR expm1 (),
120 .BR expm1f (),
121 .BR expm1l ()
122 T} Thread safety MT-Safe
123 .TE
124 .hy
125 .ad
126 .sp 1
127 .SH CONFORMING TO
128 C99, POSIX.1-2001, POSIX.1-2008.
129 .\" BSD.
130 .SH BUGS
131 Before glibc 2.17,
132 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6778
133 on certain architectures (e.g., x86, but not x86_64)
134 .BR expm1 ()
135 raised a bogus underflow floating-point exception
136 for some large negative
137 .I x
138 values (where the function result approaches \-1).
139 .PP
140 Before approximately glibc version 2.11,
141 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6814
142 .\" e.g., expm1(1e5) through expm1(1.00199970127e5),
143 .\" but not expm1(1.00199970128e5) and beyond.
144 .BR expm1 ()
145 raised a bogus invalid floating-point exception in addition to the expected
146 overflow exception, and returned a NaN instead of positive infinity,
147 for some large positive
148 .I x
149 values.
150 .PP
151 Before version 2.11,
152 .\" It looks like the fix was in 2.11, or possibly 2.12.
153 .\" I have no test system for 2.11, but 2.12 passes.
154 .\" From the source (sysdeps/i386/fpu/s_expm1.S) it looks
155 .\" like the changes were in 2.11.
156 the glibc implementation did not set
157 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6788
158 .I errno
159 to
160 .B ERANGE
161 when a range error occurred.
162 .SH SEE ALSO
163 .BR exp (3),
164 .BR log (3),
165 .BR log1p (3)