]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
3d352631 MK |
2 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
3 | .\" <mtk.manpages@gmail.com> | |
fea681da | 4 | .\" |
5fbde956 | 5 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
6 | .\" |
7 | .\" References consulted: | |
8 | .\" Linux libc source code | |
9 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
10 | .\" 386BSD man pages | |
11 | .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu) | |
12 | .\" Modified 1995-08-14 by Arnt Gulbrandsen <agulbra@troll.no> | |
13 | .\" Modified 2002-07-27 by Walter Harms | |
14 | .\" (walter.harms@informatik.uni-oldenburg.de) | |
15 | .\" | |
45186a5d | 16 | .TH LOG2 3 2021-03-22 "Linux man-pages (unreleased)" |
fea681da MK |
17 | .SH NAME |
18 | log2, log2f, log2l \- base-2 logarithmic function | |
d1482b90 AC |
19 | .SH LIBRARY |
20 | Math library | |
8fc3b2cf | 21 | .RI ( libm ", " \-lm ) |
fea681da MK |
22 | .SH SYNOPSIS |
23 | .nf | |
24 | .B #include <math.h> | |
68e4db0a | 25 | .PP |
fea681da | 26 | .BI "double log2(double " x ); |
fea681da | 27 | .BI "float log2f(float " x ); |
fea681da MK |
28 | .BI "long double log2l(long double " x ); |
29 | .fi | |
68e4db0a | 30 | .PP |
d39ad78f | 31 | .RS -4 |
cc4615cc MK |
32 | Feature Test Macro Requirements for glibc (see |
33 | .BR feature_test_macros (7)): | |
d39ad78f | 34 | .RE |
68e4db0a | 35 | .PP |
cc4615cc MK |
36 | .BR log2 (), |
37 | .BR log2f (), | |
38 | .BR log2l (): | |
9d2adbae | 39 | .nf |
5c10d2c5 | 40 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
9d2adbae | 41 | .fi |
fea681da | 42 | .SH DESCRIPTION |
5600f73a | 43 | These functions return the base 2 logarithm of |
022671eb | 44 | .IR x . |
3d352631 MK |
45 | .SH RETURN VALUE |
46 | On success, these functions return the base 2 logarithm of | |
47 | .IR x . | |
847e0d88 | 48 | .PP |
3d352631 MK |
49 | For special cases, including where |
50 | .I x | |
51 | is 0, 1, negative, infinity, or NaN, see | |
52 | .BR log (3). | |
fea681da | 53 | .SH ERRORS |
3d352631 MK |
54 | See |
55 | .BR math_error (7) | |
56 | for information on how to determine whether an error has occurred | |
57 | when calling these functions. | |
847e0d88 | 58 | .PP |
3d352631 MK |
59 | For a discussion of the errors that can occur for these functions, see |
60 | .BR log (3). | |
f0d7ce1d MK |
61 | .SH VERSIONS |
62 | These functions first appeared in glibc in version 2.1. | |
b66a6589 MS |
63 | .SH ATTRIBUTES |
64 | For an explanation of the terms used in this section, see | |
65 | .BR attributes (7). | |
c466875e MK |
66 | .ad l |
67 | .nh | |
b66a6589 MS |
68 | .TS |
69 | allbox; | |
c466875e | 70 | lbx lb lb |
b66a6589 MS |
71 | l l l. |
72 | Interface Attribute Value | |
73 | T{ | |
74 | .BR log2 (), | |
75 | .BR log2f (), | |
76 | .BR log2l () | |
77 | T} Thread safety MT-Safe | |
78 | .TE | |
c466875e MK |
79 | .hy |
80 | .ad | |
81 | .sp 1 | |
3113c7f3 | 82 | .SH STANDARDS |
9a74e018 | 83 | C99, POSIX.1-2001, POSIX.1-2008. |
847e0d88 | 84 | .PP |
3d352631 MK |
85 | The variant returning |
86 | .I double | |
87 | also conforms to | |
3c78ebef | 88 | SVr4, 4.3BSD. |
47297adb | 89 | .SH SEE ALSO |
fea681da | 90 | .BR cbrt (3), |
36268806 | 91 | .BR clog2 (3), |
be62f421 JE |
92 | .BR log (3), |
93 | .BR log10 (3), | |
fea681da | 94 | .BR sqrt (3) |