
package com.logicbig.example.math;
public class Log10Example {
public static void main(String... args) {
findLog10(5);
findLog10(24.13);
findLog10(1);
findLog10(-541.23);
findLog10(0);
findLog10(Double.POSITIVE_INFINITY);
findLog10(Double.NEGATIVE_INFINITY);
}
private static void findLog10(double x) {
double result = Math.log10(x);
System.out.printf("Math.log10(%s) = %s%n", x, result);
}
}
Output
Math.log10(5.0) = 0.6989700043360189
Math.log10(24.13) = 1.3825573219087859
Math.log10(1.0) = 0.0
Math.log10(-541.23) = NaN
Math.log10(0.0) = -Infinity
Math.log10(Infinity) = Infinity
Math.log10(-Infinity) = NaN