On Fri, 13 Sep 2024 18:44:36 GMT, Joe Darcy <[email protected]> wrote:
>> 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.
I considered using `powerOfTwoD` but it uses a `long` `+`, and performs an
additional masking which seems useless or over-cautious and does not help if
`n` is out of range (assuming the assert is not enabled).
What about a `private` similar method that just does the bare minimum and which
could also be invoked by `powerOfTwoD`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20948#discussion_r1759335507