]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 1995 Jim Van Zandt <jrv@vanzandt.mv.com> |
caba2e47 MK |
2 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
3 | .\" <mtk.manpages@gmail.com> | |
fea681da | 4 | .\" |
5fbde956 | 5 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
6 | .\" |
7 | .\" Modified 2002-07-27 by Walter Harms | |
8 | .\" (walter.harms@informatik.uni-oldenburg.de) | |
1ae6b2c7 | 9 | .TH LOG1P 3 2021-03-22 GNU "Linux Programmer's Manual" |
fea681da | 10 | .SH NAME |
9a2d673e | 11 | log1p, log1pf, log1pl \- logarithm of 1 plus argument |
297a126f AC |
12 | .SH LIBRARY |
13 | Math library | |
8fc3b2cf | 14 | .RI ( libm ", " \-lm ) |
fea681da MK |
15 | .SH SYNOPSIS |
16 | .nf | |
17 | .B #include <math.h> | |
68e4db0a | 18 | .PP |
fea681da | 19 | .BI "double log1p(double " x ); |
fea681da | 20 | .BI "float log1pf(float " x ); |
fea681da | 21 | .BI "long double log1pl(long double " x ); |
68e4db0a | 22 | .PP |
fea681da | 23 | .fi |
d39ad78f | 24 | .RS -4 |
cc4615cc MK |
25 | Feature Test Macro Requirements for glibc (see |
26 | .BR feature_test_macros (7)): | |
d39ad78f | 27 | .RE |
68e4db0a | 28 | .PP |
9d2adbae | 29 | .nf |
caba2e47 | 30 | .BR log1p (): |
5c10d2c5 MK |
31 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
32 | || _XOPEN_SOURCE >= 500 | |
33 | .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED | |
9d2adbae MK |
34 | || /* Since glibc 2.19: */ _DEFAULT_SOURCE |
35 | || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
36 | .fi | |
98c9347c | 37 | .PP |
cc4615cc MK |
38 | .BR log1pf (), |
39 | .BR log1pl (): | |
9d2adbae | 40 | .nf |
5c10d2c5 | 41 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
9d2adbae MK |
42 | || /* Since glibc 2.19: */ _DEFAULT_SOURCE |
43 | || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
44 | .fi | |
fea681da | 45 | .SH DESCRIPTION |
5600f73a | 46 | These functions return a value equivalent to |
207050fa | 47 | .PP |
2d986c92 | 48 | .nf |
2d986c92 | 49 | log (1 + \fIx\fP) |
2d986c92 | 50 | .fi |
207050fa | 51 | .PP |
5600f73a | 52 | The result is computed in a way |
022671eb MK |
53 | that is accurate even if the value of |
54 | .I x | |
55 | is near zero. | |
caba2e47 MK |
56 | .SH RETURN VALUE |
57 | On success, these functions return the natural logarithm of | |
58 | .IR "(1\ +\ x)" . | |
847e0d88 | 59 | .PP |
caba2e47 MK |
60 | If |
61 | .I x | |
62 | is a NaN, | |
63 | a NaN is returned. | |
847e0d88 | 64 | .PP |
caba2e47 MK |
65 | If |
66 | .I x | |
67 | is positive infinity, positive infinity is returned. | |
847e0d88 | 68 | .PP |
caba2e47 MK |
69 | If |
70 | .I x | |
efe294cb | 71 | is \-1, a pole error occurs, |
caba2e47 | 72 | and the functions return |
cd415e73 MK |
73 | .RB \- HUGE_VAL , |
74 | .RB \- HUGE_VALF , | |
caba2e47 | 75 | or |
cd415e73 | 76 | .RB \- HUGE_VALL , |
caba2e47 | 77 | respectively. |
847e0d88 | 78 | .PP |
caba2e47 MK |
79 | If |
80 | .I x | |
81 | is less than \-1 (including negative infinity), | |
efe294cb | 82 | a domain error occurs, |
caba2e47 MK |
83 | and a NaN (not a number) is returned. |
84 | .\" POSIX.1 specifies a possible range error if x is subnormal | |
85 | .\" glibc 2.8 doesn't do this | |
86 | .SH ERRORS | |
87 | See | |
88 | .BR math_error (7) | |
89 | for information on how to determine whether an error has occurred | |
90 | when calling these functions. | |
91 | .PP | |
92 | The following errors can occur: | |
93 | .TP | |
94 | Domain error: \fIx\fP is less than \-1 | |
523e7e59 AH |
95 | .I errno |
96 | is set to | |
1ae6b2c7 | 97 | .B EDOM |
523e7e59 | 98 | (but see BUGS). |
caba2e47 MK |
99 | An invalid floating-point exception |
100 | .RB ( FE_INVALID ) | |
101 | is raised. | |
102 | .TP | |
103 | Pole error: \fIx\fP is \-1 | |
523e7e59 AH |
104 | .I errno |
105 | is set to | |
1ae6b2c7 | 106 | .B ERANGE |
523e7e59 | 107 | (but see BUGS). |
caba2e47 MK |
108 | A divide-by-zero floating-point exception |
109 | .RB ( FE_DIVBYZERO ) | |
110 | is raised. | |
d05cb848 | 111 | .SH ATTRIBUTES |
eb71cf70 MK |
112 | For an explanation of the terms used in this section, see |
113 | .BR attributes (7). | |
c466875e MK |
114 | .ad l |
115 | .nh | |
eb71cf70 MK |
116 | .TS |
117 | allbox; | |
c466875e | 118 | lbx lb lb |
eb71cf70 MK |
119 | l l l. |
120 | Interface Attribute Value | |
121 | T{ | |
d05cb848 PH |
122 | .BR log1p (), |
123 | .BR log1pf (), | |
d05cb848 | 124 | .BR log1pl () |
eb71cf70 MK |
125 | T} Thread safety MT-Safe |
126 | .TE | |
c466875e MK |
127 | .hy |
128 | .ad | |
129 | .sp 1 | |
47297adb | 130 | .SH CONFORMING TO |
9a74e018 | 131 | C99, POSIX.1-2001, POSIX.1-2008. |
caba2e47 | 132 | .\" BSD |
523e7e59 AH |
133 | .SH BUGS |
134 | Before version 2.22, the glibc implementation did not set | |
135 | .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6792 | |
136 | .I errno | |
137 | to | |
138 | .B EDOM | |
139 | when a domain error occurred. | |
847e0d88 | 140 | .PP |
523e7e59 AH |
141 | Before version 2.22, the glibc implementation did not set |
142 | .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6792 | |
143 | .I errno | |
144 | to | |
145 | .B ERANGE | |
146 | when a range error occurred. | |
47297adb | 147 | .SH SEE ALSO |
fea681da MK |
148 | .BR exp (3), |
149 | .BR expm1 (3), | |
150 | .BR log (3) |