page_title: Binary logarithm
hierarchical_section_title: Binary logarithm
context_page_description: In mathematics, the binary logarithm is the power to which the number 2 must be raised to obtain the value n. That is, for any real number x,
  For example, the binary logarithm of 1 is 0, the binary logarithm of 2 is 1, the binary logarithm of 4 is 2, and the binary logarithm of 32 is 5.
  The binary logarithm is the logarithm to the base 2. The binary logarithm function is the inverse function of the power of two function. As well as log₂, alternative notations for the binary logarithm include lg, ld, lb, and log.
  Historically, the first application of binary logarithms was in music theory, by Leonhard Euler: the binary logarithm of a frequency ratio of two musical tones gives the number of octaves by which the tones differ. Binary logarithms can be used to calculate the length of the representation of a number in the binary numeral system, or the number of bits needed to encode a message in information theory. In computer science, they count the number of steps needed for binary search and related algorithms. Other areas
  in which the binary logarithm is frequently used include combinatorics, bioinformatics, the design of sports tournaments, and photography.
context_section_description: In mathematics, the binary logarithm (log₂ n) is the power to which the number 2 must be raised to obtain the value n. That is, for any real number x,
  For example, the binary logarithm of 1 is 0, the binary logarithm of 2 is 1, the binary logarithm of 4 is 2, and the binary logarithm of 32 is 5.
  The binary logarithm is the logarithm to the base 2. The binary logarithm function is the inverse function of the power of two function. As well as log₂, alternative notations for the binary logarithm include lg, ld, lb (the notation preferred by ISO 31-11 and ISO 80000-2), and (with a prior statement that the default base is 2) log.
  Historically, the first application of binary logarithms was in music theory, by Leonhard Euler: the binary logarithm of a frequency ratio of two musical tones gives the number of octaves by which the tones differ. Binary logarithms can be used to calculate the length of the representation of a number in the binary numeral system, or the number of bits needed to encode a message in information theory. In computer science, they count the number of steps needed for binary search and related algorithms. Other areas
  in which the binary logarithm is frequently used include combinatorics, bioinformatics, the design of sports tournaments, and photography.
  Binary logarithms are included in the standard C mathematical functions and other mathematical software packages.
  The integer part of a binary logarithm can be found using the find first set operation on an integer value, or by looking up the exponent of a floating point value.
  The fractional part of the logarithm can be calculated efficiently.
caption: Graph of log2 x as a function of a positive real number x