1LOG1P(P) POSIX Programmer's Manual LOG1P(P)
2
3
4
6 log1p, log1pf, log1pl - compute a natural logarithm
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
17 These functions shall compute log_e(1.0 + x).
18
19 An application wishing to check for error situations should set errno
20 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
21 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID
22 | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
23 occurred.
24
26 Upon successful completion, these functions shall return the natural
27 logarithm of 1.0 + x.
28
29 If x is -1, a pole error shall occur and log1p(), log1pf(), and
30 log1pl() shall return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, respec‐
31 tively.
32
33 For finite values of x that are less than -1, or if x is -Inf, a
34 domain error shall occur, and either a NaN (if supported), or an
35 implementation-defined value shall be returned.
36
37 If x is NaN, a NaN shall be returned.
38
39 If x is ±0, or +Inf, x shall be returned.
40
41 If x is subnormal, a range error may occur and x should be returned.
42
44 These functions shall fail if:
45
46 Domain Error
47 The finite value of x is less than -1, or x is -Inf.
48
49 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
50 then errno shall be set to [EDOM]. If the integer expression
51 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid
52 floating-point exception shall be raised.
53
54 Pole Error
55 The value of x is -1.
56
57 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
58 then errno shall be set to [ERANGE]. If the integer expression
59 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the divide-by-
60 zero floating-point exception shall be raised.
61
62
63 These functions may fail if:
64
65 Range Error
66 The value of x is subnormal.
67
68 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
69 then errno shall be set to [ERANGE]. If the integer expression
70 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow
71 floating-point exception shall be raised.
72
73
74 The following sections are informative.
75
77 None.
78
80 On error, the expressions (math_errhandling & MATH_ERRNO) and
81 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
82 at least one of them must be non-zero.
83
85 None.
86
88 None.
89
91 feclearexcept() , fetestexcept() , log() , the Base Definitions volume
92 of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error Conditions
93 for Mathematical Functions, <math.h>
94
96 Portions of this text are reprinted and reproduced in electronic form
97 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
98 -- Portable Operating System Interface (POSIX), The Open Group Base
99 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
100 Electrical and Electronics Engineers, Inc and The Open Group. In the
101 event of any discrepancy between this version and the original IEEE and
102 The Open Group Standard, the original IEEE and The Open Group Standard
103 is the referee document. The original Standard can be obtained online
104 at http://www.opengroup.org/unix/online.html .
105
106
107
108IEEE/The Open Group 2003 LOG1P(P)