Debian Codegraph @

upstream/debian-trixie/man3/log1p.3

raw
1 '\" t
2 .\" Copyright 1995 Jim Van Zandt <[email protected]>
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <[email protected]>
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .\" Modified 2002-07-27 by Walter Harms
9 .\" ([email protected])
10 .TH log1p 3 2024-05-02 "Linux man-pages 6.9.1"
11 .SH NAME
12 log1p, log1pf, log1pl \- logarithm of 1 plus argument
13 .SH LIBRARY
14 Math library
15 .RI ( libm ", " \-lm )
16 .SH SYNOPSIS
17 .nf
18 .B #include <math.h>
19 .P
20 .BI "double log1p(double " x );
21 .BI "float log1pf(float " x );
22 .BI "long double log1pl(long double " x );
23 .P
24 .fi
25 .RS -4
26 Feature Test Macro Requirements for glibc (see
27 .BR feature_test_macros (7)):
28 .RE
29 .P
30 .nf
31 .BR log1p ():
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 .P
39 .BR log1pf (),
40 .BR log1pl ():
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 .P
49 .nf
50 log (1 + \fIx\fP)
51 .fi
52 .P
53 The result is computed in a way
54 that is accurate even if the value of
55 .I x
56 is near zero.
57 .SH RETURN VALUE
58 On success, these functions return the natural logarithm of
59 .IR "(1\ +\ x)" .
60 .P
61 If
62 .I x
63 is a NaN,
64 a NaN is returned.
65 .P
66 If
67 .I x
68 is positive infinity, positive infinity is returned.
69 .P
70 If
71 .I x
72 is \-1, a pole error occurs,
73 and the functions return
74 .RB \- HUGE_VAL ,
75 .RB \- HUGE_VALF ,
76 or
77 .RB \- HUGE_VALL ,
78 respectively.
79 .P
80 If
81 .I x
82 is less than \-1 (including negative infinity),
83 a domain error occurs,
84 and a NaN (not a number) is returned.
85 .\" POSIX.1 specifies a possible range error if x is subnormal
86 .\" glibc 2.8 doesn't do this
87 .SH ERRORS
88 See
89 .BR math_error (7)
90 for information on how to determine whether an error has occurred
91 when calling these functions.
92 .P
93 The following errors can occur:
94 .TP
95 Domain error: \fIx\fP is less than \-1
96 .I errno
97 is set to
98 .B EDOM
99 (but see BUGS).
100 An invalid floating-point exception
101 .RB ( FE_INVALID )
102 is raised.
103 .TP
104 Pole error: \fIx\fP is \-1
105 .I errno
106 is set to
107 .B ERANGE
108 (but see BUGS).
109 A divide-by-zero floating-point exception
110 .RB ( FE_DIVBYZERO )
111 is raised.
112 .SH ATTRIBUTES
113 For an explanation of the terms used in this section, see
114 .BR attributes (7).
115 .TS
116 allbox;
117 lbx lb lb
118 l l l.
119 Interface Attribute Value
120 T{
121 .na
122 .nh
123 .BR log1p (),
124 .BR log1pf (),
125 .BR log1pl ()
126 T} Thread safety MT-Safe
127 .TE
128 .SH STANDARDS
129 C11, POSIX.1-2008.
130 .SH HISTORY
131 C99, POSIX.1-2001.
132 .\" BSD
133 .SH BUGS
134 Before glibc 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.
140 .P
141 Before glibc 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.
147 .SH SEE ALSO
148 .BR exp (3),
149 .BR expm1 (3),
150 .BR log (3)