我這就要求Math.exp(double)
然後StrictMath.exp(double)
和一個原因,我無法理解的結果上Java 8
是不同的,儘管事實上,一個很簡單的Java
測試用例從JDK
源代碼看來,Math.exp
只是代表StrictMath.exp
。上Java 8
的Java Math.exp(雙)VS StrictMath.exp(雙)
public static void main(String[] args) {
Properties p = System.getProperties();
System.out.println(p.get("java.runtime.version"));
System.out.println(p.get("java.specification.version"));
System.out.println(Math.exp(1d));
System.out.println(StrictMath.exp(1d));
}
結果:
1.8.0_66-b18
1.8
null
2.718281828459045
2.7182818284590455
和Java 7
:
1.7.0_21-b11
1.7
2.7182818284590455
2.7182818284590455
讚賞任何指針,比任何真正的問題更多的是出於好奇。
而且'Math.exp(1d)== StrictMath.exp(1d)' - >'false' – user11153
http://stackoverflow.com/questions/17410559/why-does-math-sin-delegate- to-strictmath-sin也是一個很好的描述。 – Joe