]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/log1p.3
fanotify.7: tfix
[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 .\" %%%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 by Walter Harms
28 .\" (walter.harms@informatik.uni-oldenburg.de)
29 .TH LOG1P 3 2017-09-15 "" "Linux Programmer's Manual"
30 .SH NAME
31 log1p, log1pf, log1pl \- logarithm of 1 plus argument
32 .SH SYNOPSIS
33 .nf
34 .B #include <math.h>
35 .PP
36 .BI "double log1p(double " x );
37 .BI "float log1pf(float " x );
38 .BI "long double log1pl(long double " x );
39 .PP
40 .fi
41 Link with \fI\-lm\fP.
42 .PP
43 .in -4n
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
46 .in
47 .PP
48 .ad l
49 .BR log1p ():
50 .RS 4
51 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
52 || _XOPEN_SOURCE\ >=\ 500
53 .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
54 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
55 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
56 .RE
57 .br
58 .BR log1pf (),
59 .BR log1pl ():
60 .RS 4
61 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
62 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
63 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
64 .RE
65 .ad b
66 .SH DESCRIPTION
67 These functions return a value equivalent to
68 .PP
69 .nf
70 log (1 + \fIx\fP)
71 .fi
72 .PP
73 The result is computed in a way
74 that is accurate even if the value of
75 .I x
76 is near zero.
77 .SH RETURN VALUE
78 On success, these functions return the natural logarithm of
79 .IR "(1\ +\ x)" .
80 .PP
81 If
82 .I x
83 is a NaN,
84 a NaN is returned.
85 .PP
86 If
87 .I x
88 is positive infinity, positive infinity is returned.
89 .PP
90 If
91 .I x
92 is \-1, a pole error occurs,
93 and the functions return
94 .RB - HUGE_VAL ,
95 .RB - HUGE_VALF ,
96 or
97 .RB - HUGE_VALL ,
98 respectively.
99 .PP
100 If
101 .I x
102 is less than \-1 (including negative infinity),
103 a domain error occurs,
104 and a NaN (not a number) is returned.
105 .\" POSIX.1 specifies a possible range error if x is subnormal
106 .\" glibc 2.8 doesn't do this
107 .SH ERRORS
108 See
109 .BR math_error (7)
110 for information on how to determine whether an error has occurred
111 when calling these functions.
112 .PP
113 The following errors can occur:
114 .TP
115 Domain error: \fIx\fP is less than \-1
116 .I errno
117 is set to
118 .BR EDOM
119 (but see BUGS).
120 An invalid floating-point exception
121 .RB ( FE_INVALID )
122 is raised.
123 .TP
124 Pole error: \fIx\fP is \-1
125 .I errno
126 is set to
127 .BR ERANGE
128 (but see BUGS).
129 A divide-by-zero floating-point exception
130 .RB ( FE_DIVBYZERO )
131 is raised.
132 .SH ATTRIBUTES
133 For an explanation of the terms used in this section, see
134 .BR attributes (7).
135 .TS
136 allbox;
137 lbw27 lb lb
138 l l l.
139 Interface Attribute Value
140 T{
141 .BR log1p (),
142 .BR log1pf (),
143 .BR log1pl ()
144 T} Thread safety MT-Safe
145 .TE
146 .SH CONFORMING TO
147 C99, POSIX.1-2001, POSIX.1-2008.
148 .\" BSD
149 .SH BUGS
150 Before version 2.22, the glibc implementation did not set
151 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6792
152 .I errno
153 to
154 .B EDOM
155 when a domain error occurred.
156 .PP
157 Before version 2.22, the glibc implementation did not set
158 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6792
159 .I errno
160 to
161 .B ERANGE
162 when a range error occurred.
163 .SH SEE ALSO
164 .BR exp (3),
165 .BR expm1 (3),
166 .BR log (3)