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 <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24
25 log1pf(), log1pl():
26 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
27 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
28 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
29
31 These functions return a value equivalent to
32
33 log (1 + x)
34
35 The result is computed in a way that is accurate even if the value of x
36 is near zero.
37
39 On success, these functions return the natural logarithm of (1 + x).
40
41 If x is a NaN, a NaN is returned.
42
43 If x is positive infinity, positive infinity is returned.
44
45 If x is -1, a pole error occurs, and the functions return -HUGE_VAL,
46 -HUGE_VALF, or -HUGE_VALL, respectively.
47
48 If x is less than -1 (including negative infinity), a domain error oc‐
49 curs, and a NaN (not a number) is returned.
50
52 See math_error(7) for information on how to determine whether an error
53 has occurred when calling these functions.
54
55 The following errors can occur:
56
57 Domain error: x is less than -1
58 errno is set to EDOM (but see BUGS). An invalid floating-point
59 exception (FE_INVALID) is raised.
60
61 Pole error: x is -1
62 errno is set to ERANGE (but see BUGS). A divide-by-zero float‐
63 ing-point exception (FE_DIVBYZERO) is raised.
64
66 For an explanation of the terms used in this section, see at‐
67 tributes(7).
68
69 ┌────────────────────────────────────────────┬───────────────┬─────────┐
70 │Interface │ Attribute │ Value │
71 ├────────────────────────────────────────────┼───────────────┼─────────┤
72 │log1p(), log1pf(), log1pl() │ Thread safety │ MT-Safe │
73 └────────────────────────────────────────────┴───────────────┴─────────┘
74
76 C99, POSIX.1-2001, POSIX.1-2008.
77
79 Before version 2.22, the glibc implementation did not set errno to EDOM
80 when a domain error occurred.
81
82 Before version 2.22, the glibc implementation did not set errno to
83 ERANGE when a range error occurred.
84
86 exp(3), expm1(3), log(3)
87
89 This page is part of release 5.13 of the Linux man-pages project. A
90 description of the project, information about reporting bugs, and the
91 latest version of this page, can be found at
92 https://www.kernel.org/doc/man-pages/.
93
94
95
96 2021-03-22 LOG1P(3)