Overview:
-
The function log2(num), computes the binary logarithm of a given number. The Base-2 logarithm of a given number “n” is the power to which, number 2 must be raised to obtain the number “n”.
Example:
# Example Python program that computes import math # Compute binary logrithm for 10 # Compute binary logrithm for 128 |
Output:
Base-2 logarithm of 10:3 Base-2 logarithm of 128:7 |