Reputation: 1655
I have to calculate a simple quotient:
log2(val1) / log2(val2)
I´ve tried to this with:
var valueOne = Math.log2(val1);
var valueTwo = Math.log2(val2);
var quotient = valueOne / valueTwo;
Unfortunately,it do not work.As I found out, there are obviously browser compatibility problems with Math.log2
In Chrome, I get *'Uncaught TypeError: undefined is not a function'*
How can now calculate the quotient?
Upvotes: 1
Views: 144
Reputation: 413737
The Math.log2(x)
function can be computed as Math.log(x) / Math.LN2;
. That can be derived from the nature of logarithms.
The .log2()
function is a newcomer to the Math
constructor, and not supported by all browsers.
Upvotes: 1