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
22 The functionality described on this reference page is aligned with the
23 ISO C standard. Any conflict between the requirements described here
24 and the ISO C standard is unintentional. This volume of POSIX.1‐2017
25 defers to the ISO C standard.
26
27 These functions shall compute loge(1.0 + x).
28
29 An application wishing to check for error situations should set errno
30 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
31 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
32 FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
33 occurred.
34
36 Upon successful completion, these functions shall return the natural
37 logarithm of 1.0 + x.
38
39 If x is -1, a pole error shall occur and log1p(), log1pf(), and
40 log1pl() shall return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, respec‐
41 tively.
42
43 For finite values of x that are less than -1, or if x is -Inf, a domain
44 error shall occur, and either a NaN (if supported), or an implementa‐
45 tion-defined value shall be returned.
46
47 If x is NaN, a NaN shall be returned.
48
49 If x is ±0, or +Inf, x shall be returned.
50
51 If x is subnormal, a range error may occur
52 and x should be returned.
53
54 If x is not returned, log1p(), log1pf(), and log1pl() shall return an
55 implementation-defined value no greater in magnitude than DBL_MIN,
56 FLT_MIN, and LDBL_MIN, respectively.
57
59 These functions shall fail if:
60
61 Domain Error
62 The finite value of x is less than -1, or x is -Inf.
63
64 If the integer expression (math_errhandling & MATH_ERRNO)
65 is non-zero, then errno shall be set to [EDOM]. If the
66 integer expression (math_errhandling & MATH_ERREXCEPT) is
67 non-zero, then the invalid floating-point exception shall
68 be raised.
69
70 Pole Error The value of x is -1.
71
72 If the integer expression (math_errhandling & MATH_ERRNO)
73 is non-zero, then errno shall be set to [ERANGE]. If the
74 integer expression (math_errhandling & MATH_ERREXCEPT) is
75 non-zero, then the divide-by-zero floating-point exception
76 shall be raised.
77
78 These functions may fail if:
79
80 Range Error The value of x is subnormal.
81
82 If the integer expression (math_errhandling & MATH_ERRNO)
83 is non-zero, then errno shall be set to [ERANGE]. If the
84 integer expression (math_errhandling & MATH_ERREXCEPT) is
85 non-zero, then the underflow floating-point exception shall
86 be raised.
87
88 The following sections are informative.
89
91 None.
92
94 On error, the expressions (math_errhandling & MATH_ERRNO) and
95 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
96 at least one of them must be non-zero.
97
99 None.
100
102 None.
103
105 feclearexcept(), fetestexcept(), log()
106
107 The Base Definitions volume of POSIX.1‐2017, Section 4.20, Treatment of
108 Error Conditions for Mathematical Functions, <math.h>
109
111 Portions of this text are reprinted and reproduced in electronic form
112 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
113 table Operating System Interface (POSIX), The Open Group Base Specifi‐
114 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
115 Electrical and Electronics Engineers, Inc and The Open Group. In the
116 event of any discrepancy between this version and the original IEEE and
117 The Open Group Standard, the original IEEE and The Open Group Standard
118 is the referee document. The original Standard can be obtained online
119 at http://www.opengroup.org/unix/online.html .
120
121 Any typographical or formatting errors that appear in this page are
122 most likely to have been introduced during the conversion of the source
123 files to man page format. To report such errors, see https://www.ker‐
124 nel.org/doc/man-pages/reporting_bugs.html .
125
126
127
128IEEE/The Open Group 2017 LOG1P(3P)