On Fri, 13 Sep 2024 08:56:39 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> wrote:
>> `Math.scalb(double)` can be simplified, removing a loop and using >> larger/smaller factors. > > Raffaello Giulietti has updated the pull request incrementally with one > additional commit since the last revision: > > Slight improvement. src/java.base/share/classes/java/lang/Math.java line 3325: > 3323: if (scaleFactor > -DoubleConsts.EXP_BIAS) { > 3324: if (scaleFactor <= DoubleConsts.EXP_BIAS) { > 3325: return d * longBitsToDouble((long) (scaleFactor + > DoubleConsts.EXP_BIAS) << PRECISION - 1); The longBitsToDouble call is basically an inline form of powerOfTwoD. I'd prefer to see that method used for clearer semantics. Optimization of powerOfTwoD would be fine. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20948#discussion_r1759320117