]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/log1p.3
Many pages: Fix style issues reported by `make lint-groff`
[thirdparty/man-pages.git] / man3 / log1p.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 by Walter Harms
8 .\" (walter.harms@informatik.uni-oldenburg.de)
9 .TH LOG1P 3 2021-03-22 GNU "Linux Programmer's Manual"
10 .SH NAME
11 log1p, log1pf, log1pl \- logarithm of 1 plus argument
12 .SH LIBRARY
13 Math library
14 .RI ( libm ", " \-lm )
15 .SH SYNOPSIS
16 .nf
17 .B #include <math.h>
18 .PP
19 .BI "double log1p(double " x );
20 .BI "float log1pf(float " x );
21 .BI "long double log1pl(long double " x );
22 .PP
23 .fi
24 .RS -4
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
27 .RE
28 .PP
29 .nf
30 .BR log1p ():
31 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
32 || _XOPEN_SOURCE >= 500
33 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
34 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
35 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
36 .fi
37 .PP
38 .BR log1pf (),
39 .BR log1pl ():
40 .nf
41 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
42 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
43 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
44 .fi
45 .SH DESCRIPTION
46 These functions return a value equivalent to
47 .PP
48 .nf
49 log (1 + \fIx\fP)
50 .fi
51 .PP
52 The result is computed in a way
53 that is accurate even if the value of
54 .I x
55 is near zero.
56 .SH RETURN VALUE
57 On success, these functions return the natural logarithm of
58 .IR "(1\ +\ x)" .
59 .PP
60 If
61 .I x
62 is a NaN,
63 a NaN is returned.
64 .PP
65 If
66 .I x
67 is positive infinity, positive infinity is returned.
68 .PP
69 If
70 .I x
71 is \-1, a pole error occurs,
72 and the functions return
73 .RB \- HUGE_VAL ,
74 .RB \- HUGE_VALF ,
75 or
76 .RB \- HUGE_VALL ,
77 respectively.
78 .PP
79 If
80 .I x
81 is less than \-1 (including negative infinity),
82 a domain error occurs,
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
95 .I errno
96 is set to
97 .B EDOM
98 (but see BUGS).
99 An invalid floating-point exception
100 .RB ( FE_INVALID )
101 is raised.
102 .TP
103 Pole error: \fIx\fP is \-1
104 .I errno
105 is set to
106 .B ERANGE
107 (but see BUGS).
108 A divide-by-zero floating-point exception
109 .RB ( FE_DIVBYZERO )
110 is raised.
111 .SH ATTRIBUTES
112 For an explanation of the terms used in this section, see
113 .BR attributes (7).
114 .ad l
115 .nh
116 .TS
117 allbox;
118 lbx lb lb
119 l l l.
120 Interface Attribute Value
121 T{
122 .BR log1p (),
123 .BR log1pf (),
124 .BR log1pl ()
125 T} Thread safety MT-Safe
126 .TE
127 .hy
128 .ad
129 .sp 1
130 .SH CONFORMING TO
131 C99, POSIX.1-2001, POSIX.1-2008.
132 .\" BSD
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.
140 .PP
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.
147 .SH SEE ALSO
148 .BR exp (3),
149 .BR expm1 (3),
150 .BR log (3)