]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/expm1.3
460068a6db10c81812d3dde11cba0554ee8f4904
[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 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" Modified 2002-07-27 Walter Harms
28 .\" (walter.harms@informatik.uni-oldenburg.de)
29 .\"
30 .TH EXPM1 3 2017-09-15 "" "Linux Programmer's Manual"
31 .SH NAME
32 expm1, expm1f, expm1l \- exponential minus 1
33 .SH SYNOPSIS
34 .nf
35 .B #include <math.h>
36 .PP
37 .BI "double expm1(double " x );
38 .BI "float expm1f(float " x );
39 .BI "long double expm1l(long double " x );
40 .PP
41 .fi
42 Link with \fI\-lm\fP.
43 .PP
44 .in -4n
45 Feature Test Macro Requirements for glibc (see
46 .BR feature_test_macros (7)):
47 .in
48 .PP
49 .ad l
50 .BR expm1 ():
51 .RS 4
52 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
53 || _XOPEN_SOURCE\ >=\ 500
54 .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
55 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
56 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
57 .RE
58 .br
59 .BR expm1f (),
60 .BR expm1l ():
61 .RS 4
62 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
63 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
64 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
65 .RE
66 .ad b
67 .SH DESCRIPTION
68 These functions return a value equivalent to
69 .PP
70 .nf
71 exp(x) \- 1
72 .fi
73 .PP
74 The result is computed in a way that is accurate even if the value of
75 .I x
76 is near
77 zero\(ema case where
78 .I "exp(x) \- 1"
79 would be inaccurate due to
80 subtraction of two numbers that are nearly equal.
81 .SH RETURN VALUE
82 On success, these functions return
83 .IR "exp(x)\ \-\ 1" .
84 .PP
85 If
86 .I x
87 is a NaN,
88 a NaN is returned.
89 .PP
90 If
91 .I x
92 is +0 (\-0),
93 +0 (\-0) is returned.
94 .PP
95 If
96 .I x
97 is positive infinity, positive infinity is returned.
98 .PP
99 If
100 .I x
101 is negative infinity, \-1 is returned.
102 .PP
103 If the result overflows, a range error occurs,
104 and the functions return
105 .RB - HUGE_VAL ,
106 .RB - HUGE_VALF ,
107 or
108 .RB - HUGE_VALL ,
109 respectively.
110 .SH ERRORS
111 See
112 .BR math_error (7)
113 for information on how to determine whether an error has occurred
114 when calling these functions.
115 .PP
116 The following errors can occur:
117 .TP
118 Range error, overflow
119 .I errno
120 is set to
121 .BR ERANGE
122 (but see BUGS).
123 An overflow floating-point exception
124 .RB ( FE_OVERFLOW )
125 is raised.
126 .\"
127 .\" POSIX.1 specifies an optional range error (underflow) if
128 .\" x is subnormal. Glibc does not implement this.
129 .SH ATTRIBUTES
130 For an explanation of the terms used in this section, see
131 .BR attributes (7).
132 .TS
133 allbox;
134 lbw27 lb lb
135 l l l.
136 Interface Attribute Value
137 T{
138 .BR expm1 (),
139 .BR expm1f (),
140 .BR expm1l ()
141 T} Thread safety MT-Safe
142 .TE
143 .SH CONFORMING TO
144 C99, POSIX.1-2001, POSIX.1-2008.
145 .\" BSD.
146 .SH BUGS
147 Before glibc 2.17,
148 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6778
149 on certain architectures (e.g., x86, but not x86_64)
150 .BR expm1 ()
151 raised a bogus underflow floating-point exception
152 for some large negative
153 .I x
154 values (where the function result approaches \-1),
155 .PP
156 For some large positive
157 .I x
158 values,
159 .BR expm1 ()
160 raises a bogus invalid floating-point exception in addition to the expected
161 overflow exception, and returns a NaN instead of positive infinity.
162 .\" FIXME .
163 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6814
164 .\" e.g., expm1(1e5) through expm1(1.00199970127e5),
165 .\" but not expm1(1.00199970128e5) and beyond.
166 .PP
167 Before version 2.11,
168 .\" It looks like the fix was in 2.11, or possibly 2.12.
169 .\" I have no test system for 2.11, but 2.12 passes.
170 .\" From the source (sysdeps/i386/fpu/s_expm1.S) it looks
171 .\" like the changes were in 2.11.
172 the glibc implementation did not set
173 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6788
174 .I errno
175 to
176 .B ERANGE
177 when a range error occurred.
178 .SH SEE ALSO
179 .BR exp (3),
180 .BR log (3),
181 .BR log1p (3)