Why does we still need StrictMath?

Martin Desruisseaux martin.desruisseaux at geomatys.com
Sun May 8 11:10:25 UTC 2022


Le 08/05/2022 à 10:56, Andrew Haley a écrit :

> Some targets (x86, in particular) have intrinsics (log, trig) that are 
> faster than StrictMath and also more accurate. StrictMath is not about 
> accuracy, but cross-architecture down-to-the-last bit reproducibility. 
> Whether we still need that reproducibility is, I suppose, something 
> for debate.
>
In production code, maybe not. But in test code (e.g. using JUnit), when 
the program does a lot of trigonometric operations (e.g. map 
projections), I have meet cases where a test was successful on a machine 
but failed on another machine. The systematic use of StrictMath in all 
JUnit test code ensure that the difference in behavior is not in the 
test code, so we can focus our debugging effort on the main code.

     Martin




More information about the core-libs-dev mailing list