NaN为以及类POSITIVE_INFINITY中的其他一些常量设置的值是多少Double?从源代码中,我看到它们被设置为自己,但是这是如何工作的呢?
public final class Double extends Number implements Comparable<Double> {
public static final double POSITIVE_INFINITY = POSITIVE_INFINITY;
public static final double NEGATIVE_INFINITY = NEGATIVE_INFINITY;
public static final double NaN = NaN;
public static final double MAX_VALUE = MAX_VALUE;
public static final double MIN_VALUE = MIN_VALUE;
...
}
Run Code Online (Sandbox Code Playgroud)
谢谢。
至少在OpenJDK 8、OpenJDK 9和OpenJDK 10中,它们在源代码中:
public static final double POSITIVE_INFINITY = 1.0 / 0.0;
public static final double NEGATIVE_INFINITY = -1.0 / 0.0;
public static final double NaN = 0.0d / 0.0; // (*)
public static final double MAX_VALUE = 0x1.fffffffffffffP+1023;
public static final double MIN_VALUE = 0x0.0000000000001P-1022;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
198 次 |
| 最近记录: |