1log1p(3M) Mathematical Library Functions log1p(3M)
2
3
4
6 log1p, log1pf, log1pl - compute natural logarithm
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double log1p(double x);
13
14
15 float log1pf(float x);
16
17
18 long double log1pl(long double x);
19
20
22 These functions compute log(e)(1.0 + x).
23
25 Upon successful completion, these functions return the natural loga‐
26 rithm of 1.0 + x.
27
28
29 If x is −1, a pole error occurs and log1p(), log1pf(), and log1pl()
30 return −HUGE_VAL, −HUGE_VALF, and −HUGE_VALL, respectively.
31
32
33 For finite values of x that are less than −1, or if x is −Inf, a domain
34 error occurs and a NaN is returned.
35
36
37 If x is NaN, a NaN is returned.
38
39
40 If x is ±0 or +Inf, x is returned.
41
42
43 For exceptional cases, matherr(3M) tabulates the values to be returned
44 by log1p() as specified by SVID3 and XPG3.
45
47 These functions will fail if:
48
49 Domain Error The finite value of x is less than −1, or x is -Inf.
50
51 If the integer expression (math_errhandling &
52 MATH_ERREXCEPT) is non-zero, the invalid floating-point
53 exception is raised.
54
55 The log1p() function sets errno to EDOM if the value of
56 x is less than −1.
57
58
59 Pole Error The value of x is −1.
60
61 If the integer expression (math_errhandling &
62 MATH_ERREXCEPT) is non-zero, the divide-by-zero float‐
63 ing-point exception is raised.
64
65
67 An application wanting to check for exceptions should call feclearex‐
68 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
69 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
70 non-zero, an exception has been raised. An application should either
71 examine the return value or check the floating point exception flags to
72 detect exceptions.
73
74
75 An application can also set errno to 0 before calling log1p(). On
76 return, if errno is non-zero, an error has occurred. The log1pf() and
77 log1pl() functions do not set errno.
78
80 See attributes(5) for descriptions of the following attributes:
81
82
83
84
85 ┌─────────────────────────────┬─────────────────────────────┐
86 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
87 ├─────────────────────────────┼─────────────────────────────┤
88 │Interface Stability │Standard │
89 ├─────────────────────────────┼─────────────────────────────┤
90 │MT-Level │MT-Safe │
91 └─────────────────────────────┴─────────────────────────────┘
92
94 feclearexcept(3M), fetestexcept(3M), log(3M), math.h(3HEAD), math‐
95 err(3M), attributes(5), standards(5)
96
97
98
99SunOS 5.11 12 Jul 2006 log1p(3M)