有人可以解释一下,为什么我在计算pow()时会得到不同的结果吗?
double testOne = Math.pow(10, ((10 - 20) / (10 * 2)));
System.out.println("Test One: " + testOne);
double c = 10-20;
double d = 10*2;
double f = c/d;
double testTwo = Math.pow(10, f);
System.out.println("Test Two: " + testTwo);
结果如下:
Test One: 1.0
Test Two: 0.31622776601683794