1log10(3M) Mathematical Library Functions log10(3M)
2
3
4
6 log10, log10f, log10l - base 10 logarithm function
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double log10(double x);
13
14
15 float log10f(float x);
16
17
18 long double log10l(long double x);
19
20
22 These functions compute the base 10 logarithm of x, log(10)(x).
23
25 Upon successful completion, log10() returns the base 10 logarithm of x.
26
27
28 If x is ±0, a pole error occurs and log10(), log10f(), and log10l()
29 return −HUGE_VAL, −HUGE_VALF, and −HUGE_VALL, respectively.
30
31
32 For finite values of x that are less than 0, or if x is −Inf, a domain
33 error occurs and a NaN is returned.
34
35
36 If x is NaN, a NaN is returned.
37
38
39 If x is 1, +0 is returned.
40
41
42 If x is +Inf, x is returned.
43
44
45 For exceptional cases, matherr(3M) tabulates the values to be returned
46 by log10() as specified by SVID3 and XPG3.
47
49 These functions will fail if:
50
51 Domain Error The finite value of x is negative, or x is -Inf.
52
53 If the integer expression (math_errhandling &
54 MATH_ERREXCEPT) is non-zero, the invalid floating-point
55 exception is raised.
56
57 The log10() function sets errno to EDOM if the value of
58 x is negative.
59
60
61 Pole Error The value of x is 0.
62
63 If the integer expression (math_errhandling &
64 MATH_ERREXCEPT) is non-zero, the divide-by-zero float‐
65 ing-point exception is raised.
66
67
69 An application wanting to check for exceptions should call feclearex‐
70 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
71 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
72 non-zero, an exception has been raised. An application should either
73 examine the return value or check the floating point exception flags to
74 detect exceptions.
75
76
77 An application can also set errno to 0 before calling log10(). On
78 return, if errno is non-zero, an error has occurred. The log10f() and
79 log10l() functions do not set errno.
80
82 See attributes(5) for descriptions of the following attributes:
83
84
85
86
87 ┌─────────────────────────────┬─────────────────────────────┐
88 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
89 ├─────────────────────────────┼─────────────────────────────┤
90 │Interface Stability │Standard │
91 ├─────────────────────────────┼─────────────────────────────┤
92 │MT-Level │MT-Safe │
93 └─────────────────────────────┴─────────────────────────────┘
94
96 feclearexcept(3M), fetestexcept(3M), isnan(3M), log(3M), math.h(3HEAD),
97 matherr(3M), pow(3M), attributes(5), standards(5)
98
99
100
101SunOS 5.11 12 Jul 2006 log10(3M)