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