返回到:Java Number类
sqrt() 方法用于返回参数的算术平方根。
double sqrt(double d)
返回参数的算术平方根。
public class Test{
public static void main(String args[]){
double x = 11.635;
double y = 2.76;
System.out.printf("e 的值为 %.4f%n", Math.E);
System.out.printf("sqrt(%.3f) 为 %.3f%n", x, Math.sqrt(x));
}
}
编译以上程序,输出结果为:
e 的值为 2.7183
sqrt(11.635) 为 3.411
返回到:Java Number类