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

Joe Darcy darcy at openjdk.org
Tue Sep 3 22:32:30 UTC 2024


On Tue, 3 Sep 2024 16:32:47 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> This patch adds `float16Value()` to `BigInteger` and `BigDecimal`, as well as `Float16.valueOf(BigDecimal)`.
>
> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
> 
>   More clarification in a comment.

src/java.base/share/classes/java/math/BigDecimal.java line 3837:

> 3835:         }
> 3836:         if (scale < 0) {
> 3837:             return Float16.valueOf(signum() * w.multiply(bigTenToThe(-scale)).floatValue());

Are the calls to `floatValue()` for the `scale < 0` and `scale == 0` cases meant to be calls to `float16Value()`?

If not, the different coding pattern from the analagous float and double methods should be documented in a comment.

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

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


More information about the valhalla-dev mailing list