[lworld+fp16] RFR: 8339252: Add method float16Value() to BigInteger and BigDecimal [v2]

Raffaello Giulietti rgiulietti at openjdk.org
Tue Sep 3 13:10:33 UTC 2024


On Tue, 3 Sep 2024 12:12:08 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase.
>
> src/java.base/share/classes/java/math/BigDecimal.java line 3857:
> 
>> 3855:          *      2^12 = 2^{P+1} <= i < 2^{P+5} = 2^16
>> 3856:          * Contrary to the double and float cases, here we cannot simply
>> 3857:          * declare i as short, because P + 5 < Short.SIZE fails to hold.
> 
> Comment is not very clear here, can you please elaborate on the significance of augend '5' here.

The full documentation of the algorithm is in extensive comments in the `doubleValue()` and `fullDoubleValue()` methods. Here, we only apply that logic as much as possible, adapting it for the `Float16` case.

In particular, see the discussion starting on L.4158

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1228#discussion_r1742034582


More information about the valhalla-dev mailing list