OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / 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  2013-10-14 "" "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 .sp
37 .BI "double expm1(double " x );
38 .br
39 .BI "float expm1f(float " x );
40 .br
41 .BI "long double expm1l(long double " x );
42 .sp
43 .fi
44 Link with \fI\-lm\fP.
45 .sp
46 .in -4n
47 Feature Test Macro Requirements for glibc (see
48 .BR feature_test_macros (7)):
49 .in
50 .sp
51 .ad l
52 .BR expm1 ():
53 .RS 4
54 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
55 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE ||
56 _POSIX_C_SOURCE\ >=\ 200112L;
57 .br
58 or
59 .I cc\ -std=c99
60 .RE
61 .br
62 .BR expm1f (),
63 .BR expm1l ():
64 .RS 4
65 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
66 _POSIX_C_SOURCE\ >=\ 200112L;
67 .br
68 or
69 .I cc\ -std=c99
70 .RE
71 .ad b
72 .SH DESCRIPTION
73 .I expm1(x)
74 returns a value equivalent to
75 .nf
76
77     exp(x) \- 1
78
79 .fi
80 It is
81 computed in a way that is accurate even if the value of
82 .I x
83 is near
84 zero\(ema case where
85 .I "exp(x) \- 1"
86 would be inaccurate due to
87 subtraction of two numbers that are nearly equal.
88 .SH RETURN VALUE
89 On success, these functions return
90 .IR "exp(x)\ \-\ 1" .
91
92 If
93 .I x
94 is a NaN,
95 a NaN is returned.
96
97 If
98 .I x
99 is +0 (\-0),
100 +0 (\-0) is returned.
101
102 If
103 .I x
104 is positive infinity, positive infinity is returned.
105
106 If
107 .I x
108 is negative infinity, \-1 is returned.
109
110 If the result overflows, a range error occurs,
111 and the functions return
112 .RB - HUGE_VAL ,
113 .RB - HUGE_VALF ,
114 or
115 .RB - HUGE_VALL ,
116 respectively.
117 .SH ERRORS
118 See
119 .BR math_error (7)
120 for information on how to determine whether an error has occurred
121 when calling these functions.
122 .PP
123 The following errors can occur:
124 .TP
125 Range error, overflow
126 .I errno
127 is set to
128 .BR ERANGE
129 (but see BUGS).
130 An overflow floating-point exception
131 .RB ( FE_OVERFLOW )
132 is raised.
133 .\"
134 .\" POSIX.1 specifies an optional range error (underflow) if
135 .\" x is subnormal.  Glibc does not implement this.
136 .SH ATTRIBUTES
137 .SS Multithreading (see pthreads(7))
138 The
139 .BR expm1 (),
140 .BR expm1f (),
141 and
142 .BR expm1l ()
143 functions are thread-safe.
144 .SH CONFORMING TO
145 C99, POSIX.1-2001.
146 .\" BSD.
147 .SH BUGS
148 For some large negative
149 .I x
150 values (where the function result approaches \-1),
151 .BR expm1 ()
152 raises a bogus underflow floating-point exception.
153 .\" FIXME .
154 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6778
155
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
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)
182 .SH COLOPHON
183 This page is part of release 3.68 of the Linux
184 .I man-pages
185 project.
186 A description of the project,
187 information about reporting bugs,
188 and the latest version of this page,
189 can be found at
190 \%http://www.kernel.org/doc/man\-pages/.