JDK 9 RFR of 4477961: java.lang.Math.toDegrees(double) could be optimized

Brian Burkhalter brian.burkhalter at oracle.com
Mon Sep 22 22:34:08 UTC 2014

Hi Aleksey,

On Sep 22, 2014, at 2:43 PM, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:

> Hm, and this compiler transformation works in strictfp context? I hope
> compilers do the constant folding in strictfp/fdlibm mode…


> I would probably just go and declare the private compile-time constants.
> This is safer, since: a) you are not at the mercy of optimizing compiler
> anymore (have you tried the benchmark with C1?); b) the initializing
> expressions are FP-strict, less opportunity for hard to diagnose numeric
> problem.

I created an alternate webrev using compile-time constants per your suggestion:


The performance improvement is similar to that cited for webrev.00.

If this version is preferable it will need approval from a JDK 9 Reviewer, of course.



More information about the core-libs-dev mailing list