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

Raffaello Giulietti rgiulietti at openjdk.org
Tue Sep 3 16:35:31 UTC 2024


On Tue, 3 Sep 2024 13:07:46 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> 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

I hope I made the comment a bit clearer.

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

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


More information about the valhalla-dev mailing list