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