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