JDK 9 RFR of 4477961: java.lang.Math.toDegrees(double) could be optimized
mike.duigou at oracle.com
Mon Sep 22 21:24:39 UTC 2014
I think it is always important note when a change may result in different results for some inputs. I will reiterate for the record what's mentioned in the bug:
> However, one caveat is that this may affect the results of some calculations.
> For example, some range of numbers that used to overflow to infinity by
> performing the multiplication by 180, will now not overflow and will return a
> valid result.
This also applies to very small quantities in toRadians where dividing by 180 may have previously resulted in a zero.
On Sep 22 2014, at 14:10 , Brian Burkhalter <Brian.Burkhalter at oracle.com> wrote:
> Another relatively small numerics fix:
> Issue: https://bugs.openjdk.java.net/browse/JDK-4477961
> Webrev: http://cr.openjdk.java.net/~bpb/4477961/webrev.00/
> Summary: Change constructs like “a * B / C” and “u / V * W” to “x * (Y / Z)” where lower case denotes a variable and upper case a constant. This forces the constant value (Y / Z) to be evaluated only once per VM instance, and replaces division of the variable with multiplication. The resulting performance improvement is more than 300% as measure by JMH on a MacBookPro11,1 dual core i7 running Mac OS 10.9.5.
More information about the core-libs-dev