The answer is that it depends on the vendor and platform. Here is what the Math class javadoc says on the subject:
"Unlike some of the numerical methods of the StrictMath class, all implementations of the equivalent functions of the Math class are not defined to return bit-by-bit for the same results. This relaxation allows for more efficient implementations where strict reproducibility is not required."
"(By default, many of the Math methods simply call the equivalent method in StrictMath to implement them.) Code generators are encouraged to use their own platform-based libraries or microprocessor instructions, if available, to provide higher-performance math implementations. Such high-performance implementations should still comply specifications for math. "
It is likely that a typical JVM will perform operations like calls to C libraries, which in turn will use FPU instructions, if any. But you cannot generalize ...
If you want to perform mathematical operations when the algorithms are tightly defined, you need to use StrictMath , not Math . StrictMath operations for operations (I understand) are guaranteed to give the same answers on any Java platform. The disadvantage is that they are most likely slower.
source share