RFR: 8339934: Simplify Math.scalb(double) method [v3]

Joe Darcy darcy at openjdk.org
Tue Sep 17 02:23:09 UTC 2024


On Fri, 13 Sep 2024 19:33:51 GMT, Raffaello Giulietti <rgiulietti at 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:
> 
>   Introduce primPowerOfTwoD and make use of it.

Moving to Approved.

src/java.base/share/classes/java/lang/Math.java line 3317:

> 3315:      */
> 3316:     public static double scalb(double d, int scaleFactor) {
> 3317:         /*

FWIW, I wrote this code a long time ago prior to OpenJDK. IIRC, some of the complications of this method may have been due to wanted to avoid declaring the method `strictfp` back when  `strictfp` vs default-FP semantics were an issue.

-------------

Marked as reviewed by darcy (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20948#pullrequestreview-2308128327
PR Review Comment: https://git.openjdk.org/jdk/pull/20948#discussion_r1762185901


More information about the core-libs-dev mailing list