Android examples for java.lang:Math
Number's logarithm Special cases: log(+0.0) = -infinity log(-0.0) = -infinity log((anything < 0) = NaN log(+infinity) = +infinity log(-infinity) = NaN log(NaN) = NaN
//package com.java2s; public class Main { /**//from www . j a v a 2 s. c o m * Number's logarithm <br> * Special cases: * * <li>log(+0.0) = -infinity</li> <li>log(-0.0) = -infinity</li><li> * log((anything < 0) = NaN</li> <li>log(+infinity) = +infinity</li><li> * log(-infinity) = NaN</li><li>log(NaN) = NaN</li> * * * @param number * @return Returns the closest double approximation of the natural logarithm * of the argument. The returned result is within 1 ulp (unit in the * last place) of the real result. */ public static float logarithm(float number) { return (float) Math.log(number); } }