Java Math.log10()方法用法实例教程 - 返回以10为底的double的值
- 如果参数是NaN或小于零,那么结果是NaN. //异常
- 如果参数是正无穷大,那么结果为正无穷大.
- 如果参数是正零或负零,那么结果是负无穷大.
- 如果参数是等于10N整数n,那么结果是n.
package com.yiibai; import java.lang.*; public class MathDemo { public static void main(String[] args) { // get two double numbers double x = 60984.1; double y = 1000; // get the base 10 logarithm for x System.out.println("Math.log10(" + x + ")=" + Math.log10(x)); // get the base 10 logarithm for y System.out.println("Math.log10(" + y + ")=" + Math.log10(y)); } }
Math.log10(60984.1)=4.78521661890635 Math.log10(1000)=3.0转载:http://www.yiibai.com/javalang/math_log10.html