OSDN Git Service

(split) LDP man-pages の original/ を v3.29 に更新。
[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 .\" 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.
13 .\"
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.
21 .\"
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)
27 .TH LOG1P 3   2010-09-20 "" "Linux Programmer's Manual"
28 .SH NAME
29 log1p, log1pf, log1pl \-  logarithm of 1 plus argument
30 .SH SYNOPSIS
31 .nf
32 .B #include <math.h>
33 .sp
34 .BI "double log1p(double " x );
35 .br
36 .BI "float log1pf(float " x );
37 .br
38 .BI "long double log1pl(long double " x );
39 .sp
40 .fi
41 Link with \fI\-lm\fP.
42 .sp
43 .in -4n
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
46 .in
47 .sp
48 .ad l
49 .BR log1p ():
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
55 or
56 .I cc\ -std=c99
57 .RE
58 .br
59 .BR log1pf (),
60 .BR log1pl ():
61 .RS 4
62 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
63 _POSIX_C_SOURCE\ >=\ 200112L;
64 .br
65 or
66 .I cc\ -std=c99
67 .RE
68 .ad b
69 .SH DESCRIPTION
70 .I log1p(x)
71 returns a value equivalent to
72 .nf
73
74     log (1 + \fIx\fP)
75
76 .fi
77 It is computed in a way
78 that is accurate even if the value of \fIx\fP is near zero.
79 .SH RETURN VALUE
80 On success, these functions return the natural logarithm of
81 .IR "(1\ +\ x)" .
82
83 If
84 .I x
85 is a NaN,
86 a NaN is returned.
87
88 If
89 .I x
90 is positive infinity, positive infinity is returned.
91
92 If
93 .I x
94 is \-1, a pole error occurs,
95 and the functions return
96 .RB - HUGE_VAL ,
97 .RB - HUGE_VALF ,
98 or
99 .RB - HUGE_VALL ,
100 respectively.
101
102 If
103 .I x
104 is less than \-1 (including negative infinity),
105 a domain error occurs,
106 and 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
110 See
111 .BR math_error (7)
112 for information on how to determine whether an error has occurred
113 when calling these functions.
114 .PP
115 The following errors can occur:
116 .TP
117 Domain error: \fIx\fP is less than \-1
118 .\" .I errno
119 .\" is set to
120 .\" .BR EDOM .
121 An invalid floating-point exception
122 .RB ( FE_INVALID )
123 is raised.
124 .TP
125 Pole error: \fIx\fP is \-1
126 .\" .I errno
127 .\" is set to
128 .\" .BR ERANGE .
129 A divide-by-zero floating-point exception
130 .RB ( FE_DIVBYZERO )
131 is raised.
132 .PP
133 These 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
138 .SH "CONFORMING TO"
139 C99, POSIX.1-2001.
140 .\" BSD
141 .SH "SEE ALSO"
142 .BR exp (3),
143 .BR expm1 (3),
144 .BR log (3)