Thanks, andrew. I searched on the web and I understand now: Fdlibm native library has been ported in Java code for jdk9 (like the jafama library).
Cbrt changeset: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/7dc9726cfa82 I will anyway compare jdk9 with latest jafama 2.2 to have an up-to-date comparison. Does somebody else need a faster but less accurate math library ? JaFaMa has such alternative methods... Preserving double-precision may be very costly in terms of performance and sometimes such accuracy is not required. Last question: Is there a sin & cos function returning both values for the same angle ? It is very useful to compute exact fourrier transform... It is called sinAndCos(double wrappers) in jafama. Cheers, Laurent Le 9 nov. 2017 17:08, "Andrew Haley" <a...@redhat.com> a écrit : > On 09/11/17 15:02, Laurent Bourgès wrote: > > --- testing cbrt(double) = pow(double, 1/3) --- > > Loop on Math.pow(double, 1/3), args in [-10.0,10.0], took 0.739 s > > Loop on FastMath.cbrt(double), args in [-10.0,10.0], took 0.166 s > > Loop on Math.pow(double, 1/3), args in [-0.7,0.7], took 0.746 s > > Loop on FastMath.cbrt(double), args in [-0.7,0.7], took 0.166 s > > Loop on Math.pow(double, 1/3), args in [-0.1,0.1], took 0.742 s > > Loop on FastMath.cbrt(double), args in [-0.1,0.1], took 0.165 s > > Loop on Math.pow(double, 1/3), args in all magnitudes, took 0.753 s > > Loop on FastMath.cbrt(double), args in all magnitudes, took 0.244 > > > > Conclusion: > > - acos / asin / atan functions are quite slow: it confirms these are not > > optimized by hotspot intrinsics. > > > > - cbrt() is slower than sqrt() : 1.1s vs 0.1 => 10x slower > > - cbrt() is slower than pow(1/3) : 1.1s vs 0.7s => 50% slower > > No. cbrt() is faster than pow(1/3) : 0.24 vs 0.75 > > -- > Andrew Haley > Java Platform Lead Engineer > Red Hat UK Ltd. <https://www.redhat.com> > EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 >