So I have this script that use Javascript's Math.log2()
function. Tested it in IE 9 today and found out that IE does not support log2. It only supports log.
Does anyone know of a way that I can get the same result as log base 2? An example of my code is below:
var number = 16,
exponent = Math.log2(number);
//Will return 4
return exponent;
Expression Math.log(number) / Math.log(2)
is equivalent to Math.log2(number)
http://www.mathwords.com/c/change_of_base_formula.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With