]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/log1p.3
random.4: spfix
[thirdparty/man-pages.git] / man3 / log1p.3
CommitLineData
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
MK
4.\"
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
fea681da
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
24.\"
25.\" Modified 2002-07-27 by Walter Harms
26.\" (walter.harms@informatik.uni-oldenburg.de)
50831f9b 27.TH LOG1P 3 2010-09-20 "" "Linux Programmer's Manual"
fea681da 28.SH NAME
9a2d673e 29log1p, log1pf, log1pl \- logarithm of 1 plus argument
fea681da
MK
30.SH SYNOPSIS
31.nf
32.B #include <math.h>
33.sp
34.BI "double log1p(double " x );
d39541ec 35.br
fea681da 36.BI "float log1pf(float " x );
d39541ec 37.br
fea681da 38.BI "long double log1pl(long double " x );
c13182ef 39.sp
fea681da 40.fi
cc4615cc
MK
41Link with \fI\-lm\fP.
42.sp
43.in -4n
44Feature Test Macro Requirements for glibc (see
45.BR feature_test_macros (7)):
46.in
47.sp
48.ad l
caba2e47 49.BR log1p ():
1b5ffa62
MK
50.RS 4
51_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
52_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE ||
53_POSIX_C_SOURCE\ >=\ 200112L;
54.br
55or
caba2e47 56.I cc\ -std=c99
1b5ffa62 57.RE
caba2e47 58.br
cc4615cc
MK
59.BR log1pf (),
60.BR log1pl ():
1b5ffa62
MK
61.RS 4
62_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
63_POSIX_C_SOURCE\ >=\ 200112L;
64.br
65or
cc4615cc 66.I cc\ -std=c99
1b5ffa62 67.RE
cc4615cc 68.ad b
fea681da 69.SH DESCRIPTION
2d986c92
MK
70.I log1p(x)
71returns a value equivalent to
72.nf
73
74 log (1 + \fIx\fP)
75
76.fi
ca7b3c18 77It is computed in a way
fea681da 78that is accurate even if the value of \fIx\fP is near zero.
caba2e47
MK
79.SH RETURN VALUE
80On success, these functions return the natural logarithm of
81.IR "(1\ +\ x)" .
82
83If
84.I x
85is a NaN,
86a NaN is returned.
87
88If
89.I x
90is positive infinity, positive infinity is returned.
91
92If
93.I x
efe294cb 94is \-1, a pole error occurs,
caba2e47
MK
95and the functions return
96.RB - HUGE_VAL ,
97.RB - HUGE_VALF ,
98or
99.RB - HUGE_VALL ,
100respectively.
101
102If
103.I x
104is less than \-1 (including negative infinity),
efe294cb 105a domain error occurs,
caba2e47
MK
106and a NaN (not a number) is returned.
107.\" POSIX.1 specifies a possible range error if x is subnormal
108.\" glibc 2.8 doesn't do this
109.SH ERRORS
110See
111.BR math_error (7)
112for information on how to determine whether an error has occurred
113when calling these functions.
114.PP
115The following errors can occur:
116.TP
117Domain error: \fIx\fP is less than \-1
118.\" .I errno
119.\" is set to
120.\" .BR EDOM .
121An invalid floating-point exception
122.RB ( FE_INVALID )
123is raised.
124.TP
125Pole error: \fIx\fP is \-1
126.\" .I errno
127.\" is set to
128.\" .BR ERANGE .
129A divide-by-zero floating-point exception
130.RB ( FE_DIVBYZERO )
131is raised.
132.PP
133These functions do not set
134.IR errno .
135.\" FIXME . Is it intentional that these functions do not set errno?
136.\" log(), log2(), log10() do set errno
137.\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6792
fea681da 138.SH "CONFORMING TO"
caba2e47
MK
139C99, POSIX.1-2001.
140.\" BSD
fea681da
MK
141.SH "SEE ALSO"
142.BR exp (3),
143.BR expm1 (3),
144.BR log (3)