This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Log2

Log2[x]
gives the base-2 logarithm of x.
  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • Log2 gives exact integer or rational number results when possible.
  • For certain special arguments, Log2 automatically evaluates to exact values.
  • Log2 can be evaluated to arbitrary numerical precision.
  • Log2 automatically threads over lists.
Log2 gives the logarithm to base 2:
Log2 gives the logarithm to base 2:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
Evaluate for complex argument:
Evaluate to arbitrary precision:
The precision of the output tracks the precision of the input:
Log2 threads element-wise over lists:
TraditionalForm formatting:
Worst-case complexity of merge sort algorithm from its functional equation:
Best-case complexity of merge sort algorithm:
Bubble sort is asymptotically worse than merge sort:
Find the age of a sample in units of its half-life time:
Compute the number of bits needed to store a large integer:
Compare to the exact result:
Number of bits used to represent Mathematica's machine reals:
Simplification with assumptions:
New in 7