如果x的x次幂结果为10(参见【图1.png】),你能计算出x的近似值吗?
显然,这个值是介于2和3之间的一个数字。
请把x的值计算到小数后6位(四舍五入),并填写这个小数值。
注意:只填写一个小数,不要写任何多余的符号或说明。
import java.text.DecimalFormat;
public class BB0503 {
public static void main(String[] args) {
// TODO Auto-generated method stub
double x = 2.0;
while(x<3.0){
x = x + 0.00000001;
if(Math.abs(Math.pow(x,x)-10.0)<0.000001){
System.out.println(formatDouble4(x));
}
}
System.out.println("1");
}
private static double pow(double x, double x2) {
// TODO Auto-generated method stub
return 0;
}
public static String formatDouble4(double d) {
DecimalFormat df = new DecimalFormat("#.000000");
return df.format(d);
}
}