Java Reference
In-Depth Information
> Math.sqrt(2); // same as Math.SQRT2
<< 1.4142135623730951
> Math.sqrt(-1); // No built in imaginary numbers!
<< NaN
The Math.log() method returns the natural logarithm of a number:
> Math.log(Math.E); // Natural logs have a base of Euler's
constant
<< 1
> Math.log(1); // log of 1 is zero
<< 0
> Math.log(0); // You can't take the log of zero
<< -Infinity
> Math.log(-2); // You can't take logs of negative numbers
<< NaN
The Math.max() method returns the maximum number from its arguments:
> Math.max(1,2,3);
<< 3
> Math.max(Math.PI,Math.SQRT2, Math.E);
<< 3.141592653589793
And the Math.min() method unsurprisingly returns the minimum number from the giv-
en arguments:
> Math.min(1,2,3);
<< 1
> Math.min(Math.PI,Math.SQRT2, Math.E);
<< 1.4142135623730951
Search WWH ::




Custom Search