我能获得PI的第N位数的最大N是多少?
答案 0 :(得分:6)
public static final double PI = 3.141592653589793d
所以N = 16
这里的 API说:http://docs.oracle.com/javase/6/docs/api/constant-values.html#java.lang.Math.PI
<小时/>
但确实 Math.class的源代码:
public static final double PI = 3.14159265358979323846;
和N = 21
无论如何 - 这有点奇怪;)
答案 1 :(得分:5)
这是源代码中写的:
/**
* The {@code double} value that is closer than any other to
* <i>pi</i>, the ratio of the circumference of a circle to its
* diameter.
*/
public static final double PI = 3.14159265358979323846;
答案 2 :(得分:2)
答案 3 :(得分:2)
答案 4 :(得分:0)
在源代码中:
/**
* The {@code double} value that is closer than any other to
* <i>pi</i>, the ratio of the circumference of a circle to its
* diameter.
*/
public static final double PI = 3.14159265358979323846;
答案 5 :(得分:-1)
Pi的Java常量是近似值。 Pi的精确值在大多数计算中都是无关紧要的。