Debian Codegraph @

upstream/debian-unstable/man3/log2.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH log2 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 log2, log2f, log2l \- base-2 logarithmic function
10 .SH LIBRARY
11 Math library
12 .RI ( libm ,\~ \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B #include <math.h>
16 .P
17 .BI "double log2(double " x );
18 .BI "float log2f(float " x );
19 .BI "long double log2l(long double " x );
20 .fi
21 .P
22 .RS -4
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
25 .RE
26 .P
27 .BR log2 (),
28 .BR log2f (),
29 .BR log2l ():
30 .nf
31 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
32 .fi
33 .SH DESCRIPTION
34 These functions return the base-2 logarithm of
35 .IR x .
36 .SH RETURN VALUE
37 On success, these functions return the base-2 logarithm of
38 .IR x .
39 .P
40 For special cases, including where
41 .I x
42 is 0, 1, negative, infinity, or NaN, see
43 .BR log (3).
44 .SH ERRORS
45 See
46 .BR math_error (7)
47 for information on how to determine whether an error has occurred
48 when calling these functions.
49 .P
50 For a discussion of the errors that can occur for these functions, see
51 .BR log (3).
52 .SH ATTRIBUTES
53 For an explanation of the terms used in this section, see
54 .BR attributes (7).
55 .TS
56 allbox;
57 lbx lb lb
58 l l l.
59 Interface Attribute Value
60 T{
61 .na
62 .nh
63 .BR log2 (),
64 .BR log2f (),
65 .BR log2l ()
66 T} Thread safety MT-Safe
67 .TE
68 .SH STANDARDS
69 C11, POSIX.1-2008.
70 .SH HISTORY
71 glibc 2.1.
72 C99, POSIX.1-2001.
73 .P
74 The variant returning
75 .I double
76 also conforms to
77 SVr4, 4.3BSD.
78 .SH SEE ALSO
79 .BR cbrt (3),
80 .BR clog2 (3),
81 .BR log (3),
82 .BR log10 (3),
83 .BR sqrt (3)