]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>. |
2 | .\" | |
3 | .\" Permission is granted to make and distribute verbatim copies of this | |
4 | .\" manual provided the copyright notice and this permission notice are | |
5 | .\" preserved on all copies. | |
6 | .\" | |
7 | .\" Permission is granted to copy and distribute modified versions of this | |
8 | .\" manual under the conditions for verbatim copying, provided that the | |
9 | .\" entire resulting derived work is distributed under the terms of a | |
10 | .\" permission notice identical to this one. | |
c13182ef | 11 | .\" |
fea681da MK |
12 | .\" Since the Linux kernel and libraries are constantly changing, this |
13 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
14 | .\" responsibility for errors or omissions, or for damages resulting from | |
15 | .\" the use of the information contained herein. The author(s) may not | |
16 | .\" have taken the same level of care in the production of this manual, | |
17 | .\" which is licensed free of charge, as they might when working | |
18 | .\" professionally. | |
c13182ef | 19 | .\" |
fea681da MK |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
22 | .\" | |
23 | .\" Inspired by a page by Walter Harms created 2002-08-10 | |
24 | .\" | |
25 | .TH LOGB 3 2004-10-31 "" "Linux Programmer's Manual" | |
26 | .SH NAME | |
27 | logb, logbf, logbl \- get exponent of a floating point value | |
28 | .SH SYNOPSIS | |
29 | .B #include <math.h> | |
30 | .sp | |
31 | .BI "double logb(double " x ); | |
32 | .br | |
33 | .BI "float logbf(float " x ); | |
34 | .br | |
35 | .BI "long double logbl(long double " x ); | |
36 | .sp | |
37 | Link with \-lm. | |
38 | .SH DESCRIPTION | |
39 | These functions extract the exponent of | |
40 | .I x | |
c13182ef MK |
41 | and return it as a floating-point value. |
42 | If | |
fea681da | 43 | .B FLT_RADIX |
c13182ef MK |
44 | is two, |
45 | .BI logb( x ) | |
fea681da MK |
46 | is equal to |
47 | .BI floor(log2( x ))\fR, | |
48 | except it's probably faster. | |
49 | .LP | |
50 | If | |
51 | .I x | |
c13182ef | 52 | is de-normalized, |
63aa9df0 | 53 | .BR logb () |
fea681da MK |
54 | returns the exponent |
55 | .I x | |
56 | would have if it were normalized. | |
57 | .LP | |
58 | If | |
59 | .I x | |
c65433e6 | 60 | is zero, \-HUGE_VAL (resp. \-HUGE_VALF, \-HUGE_VALL) |
fea681da MK |
61 | is returned, and a pole error occurs. |
62 | If | |
63 | .I x | |
64 | is infinite, plus infinity is returned. | |
65 | If | |
66 | .I x | |
67 | is NaN, NaN is returned. | |
68 | .\" .SH "RETURN VALUE" | |
69 | .\" These functions return the exponent part of their argument. | |
70 | .SH ERRORS | |
71 | In order to check for errors, set | |
72 | .I errno | |
73 | to zero and call | |
74 | .I feclearexcept(FE_ALL_EXCEPT) | |
c13182ef MK |
75 | before calling these functions. |
76 | On return, if | |
fea681da MK |
77 | .I errno |
78 | is non-zero or | |
79 | .I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) | |
80 | is non-zero, an error has occurred. | |
81 | .LP | |
82 | If an error occurs and | |
83 | .I "(math_errhandling & MATH_ERRNO)" | |
84 | is non-zero, then | |
85 | .I errno is set to | |
86 | .BR ERANGE . | |
87 | If an error occurs and | |
88 | .I "(math_errhandling & MATH_ERREXCEPT)" | |
89 | is non-zero, then the divide-by-zero floating-point exception is raised. | |
90 | .LP | |
91 | A pole error occurs when | |
92 | .I x | |
93 | is zero. | |
94 | .SH HISTORY | |
95 | The | |
e511ffb6 | 96 | .BR logb () |
b14d4aa5 MK |
97 | function occurs in 4.3BSD. |
98 | .\" see IEEE.3 in the 4.3BSD manual | |
fea681da | 99 | .SH "CONFORMING TO" |
68e1685c | 100 | C99 |
fea681da MK |
101 | .SH "SEE ALSO" |
102 | .BR log (3), | |
103 | .BR ilogb (3) |