OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / 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   2014-02-28 "" "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 .sp
36 .BI "double log1p(double " x );
37 .br
38 .BI "float log1pf(float " x );
39 .br
40 .BI "long double log1pl(long double " x );
41 .sp
42 .fi
43 Link with \fI\-lm\fP.
44 .sp
45 .in -4n
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
48 .in
49 .sp
50 .ad l
51 .BR log1p ():
52 .RS 4
53 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
54 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE ||
55 _POSIX_C_SOURCE\ >=\ 200112L;
56 .br
57 or
58 .I cc\ -std=c99
59 .RE
60 .br
61 .BR log1pf (),
62 .BR log1pl ():
63 .RS 4
64 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
65 _POSIX_C_SOURCE\ >=\ 200112L;
66 .br
67 or
68 .I cc\ -std=c99
69 .RE
70 .ad b
71 .SH DESCRIPTION
72 .I log1p(x)
73 returns a value equivalent to
74 .nf
75
76     log (1 + \fIx\fP)
77
78 .fi
79 It is computed in a way
80 that is accurate even if the value of
81 .I x
82 is near zero.
83 .SH RETURN VALUE
84 On success, these functions return the natural logarithm of
85 .IR "(1\ +\ x)" .
86
87 If
88 .I x
89 is a NaN,
90 a NaN is returned.
91
92 If
93 .I x
94 is positive infinity, positive infinity is returned.
95
96 If
97 .I x
98 is \-1, a pole error occurs,
99 and the functions return
100 .RB - HUGE_VAL ,
101 .RB - HUGE_VALF ,
102 or
103 .RB - HUGE_VALL ,
104 respectively.
105
106 If
107 .I x
108 is less than \-1 (including negative infinity),
109 a domain error occurs,
110 and a NaN (not a number) is returned.
111 .\" POSIX.1 specifies a possible range error if x is subnormal
112 .\" glibc 2.8 doesn't do this
113 .SH ERRORS
114 See
115 .BR math_error (7)
116 for information on how to determine whether an error has occurred
117 when calling these functions.
118 .PP
119 The following errors can occur:
120 .TP
121 Domain error: \fIx\fP is less than \-1
122 .\" .I errno
123 .\" is set to
124 .\" .BR EDOM .
125 An invalid floating-point exception
126 .RB ( FE_INVALID )
127 is raised.
128 .TP
129 Pole error: \fIx\fP is \-1
130 .\" .I errno
131 .\" is set to
132 .\" .BR ERANGE .
133 A divide-by-zero floating-point exception
134 .RB ( FE_DIVBYZERO )
135 is raised.
136 .PP
137 These functions do not set
138 .IR errno .
139 .\" FIXME . Is it intentional that these functions do not set errno?
140 .\" log(), log2(), log10() do set errno
141 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6792
142 .SH ATTRIBUTES
143 .SS Multithreading (see pthreads(7))
144 The
145 .BR log1p (),
146 .BR log1pf (),
147 and
148 .BR log1pl ()
149 functions are thread-safe.
150 .SH CONFORMING TO
151 C99, POSIX.1-2001.
152 .\" BSD
153 .SH SEE ALSO
154 .BR exp (3),
155 .BR expm1 (3),
156 .BR log (3)
157 .SH COLOPHON
158 This page is part of release 3.79 of the Linux
159 .I man-pages
160 project.
161 A description of the project,
162 information about reporting bugs,
163 and the latest version of this page,
164 can be found at
165 \%http://www.kernel.org/doc/man\-pages/.