1logb(3M) Mathematical Library Functions logb(3M)
2
3
4
6 logb, logbf, logbl - radix-independent exponent
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double logb(double x);
13
14
15 float logbf(float x);
16
17
18 long double logbl(long double x);
19
20
21 cc [ flag... ] file... -lm [ library... ]
22 #include <math.h>
23
24 double logb(double x);
25
26
27 float logbf(float x);
28
29
30 long double logbl(long double x);
31
32
34 These functions compute the exponent of x, which is the integral part
35 of log(r) |x|, as a signed floating point value, for non-zero x, where
36 r is the radix of the machine's floating-point arithmetic, which is the
37 value of FLT_RADIX defined in the <float.h> header.
38
40 Upon successful completion, these functions return the exponent of x.
41
42
43 If x is subnormal:
44
45 o For SUSv3-conforming applications compiled with the c99 com‐
46 piler driver (see standards(5)), the exponent of x as if x
47 were normalized is returned.
48
49 o Otherwise, if compiled with the cc compiler driver, −1022,
50 −126, and −16382 are returned for logb(), logbf(), and
51 logbl(), respectively.
52
53
54 If x is ±0, a pole error occurs and logb(), logbf(), and logbl() return
55 −HUGE_VAL, −HUGE_VALF, and −HUGE_VALL, respectively.
56
57
58 If x is NaN, a NaN is returned.
59
60
61 If x is ±Inf, +Inf is returned.
62
64 These functions will fail if:
65
66 Pole Error The value of x is ±0.
67
68 If the integer expression (math_errhandling & MATH_ERREX‐
69 CEPT) is non-zero, the divide-by-zero floating-point
70 exception is raised.
71
72 The logb() function sets errno to EDOM if the value of x
73 is 0.
74
75
77 An application wanting to check for exceptions should call feclearex‐
78 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
79 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
80 non-zero, an exception has been raised. An application should either
81 examine the return value or check the floating point exception flags to
82 detect exceptions.
83
84
85 An application can also set errno to 0 before calling logb(). On
86 return, if errno is non-zero, an error has occurred. The logbf() and
87 logbl() functions do not set errno.
88
90 See attributes(5) for descriptions of the following attributes:
91
92
93
94
95 ┌─────────────────────────────┬─────────────────────────────┐
96 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
97 ├─────────────────────────────┼─────────────────────────────┤
98 │Interface Stability │Standard │
99 ├─────────────────────────────┼─────────────────────────────┤
100 │MT-Level │MT-Safe │
101 └─────────────────────────────┴─────────────────────────────┘
102
104 feclearexcept(3M), fetestexcept(3M), ilogb(3M), math.h(3HEAD), math‐
105 err(3M), scalb(3M), attributes(5), standards(5)
106
107
108
109SunOS 5.11 12 Jul 2006 logb(3M)