1LOG1P(3) Linux Programmer's Manual LOG1P(3)
2
3
4
6 log1p, log1pf, log1pl - logarithm of 1 plus argument
7
9 #include <math.h>
10
11 double log1p(double x);
12 float log1pf(float x);
13 long double log1pl(long double x);
14
15 Link with -lm.
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 log1p():
20 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21 || _XOPEN_SOURCE >= 500
22 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24 log1pf(), log1pl():
25 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
26 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
27 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
28
30 These functions return a value equivalent to
31
32 log (1 + x)
33
34 The result is computed in a way that is accurate even if the value of x
35 is near zero.
36
38 On success, these functions return the natural logarithm of (1 + x).
39
40 If x is a NaN, a NaN is returned.
41
42 If x is positive infinity, positive infinity is returned.
43
44 If x is -1, a pole error occurs, and the functions return -HUGE_VAL,
45 -HUGE_VALF, or -HUGE_VALL, respectively.
46
47 If x is less than -1 (including negative infinity), a domain error
48 occurs, and a NaN (not a number) is returned.
49
51 See math_error(7) for information on how to determine whether an error
52 has occurred when calling these functions.
53
54 The following errors can occur:
55
56 Domain error: x is less than -1
57 errno is set to EDOM (but see BUGS). An invalid floating-point
58 exception (FE_INVALID) is raised.
59
60 Pole error: x is -1
61 errno is set to ERANGE (but see BUGS). A divide-by-zero float‐
62 ing-point exception (FE_DIVBYZERO) is raised.
63
65 For an explanation of the terms used in this section, see
66 attributes(7).
67
68 ┌────────────────────────────┬───────────────┬─────────┐
69 │Interface │ Attribute │ Value │
70 ├────────────────────────────┼───────────────┼─────────┤
71 │log1p(), log1pf(), log1pl() │ Thread safety │ MT-Safe │
72 └────────────────────────────┴───────────────┴─────────┘
74 C99, POSIX.1-2001, POSIX.1-2008.
75
77 Before version 2.22, the glibc implementation did not set errno to EDOM
78 when a domain error occurred.
79
80 Before version 2.22, the glibc implementation did not set errno to
81 ERANGE when a range error occurred.
82
84 exp(3), expm1(3), log(3)
85
87 This page is part of release 5.04 of the Linux man-pages project. A
88 description of the project, information about reporting bugs, and the
89 latest version of this page, can be found at
90 https://www.kernel.org/doc/man-pages/.
91
92
93
94 2017-09-15 LOG1P(3)