RFR: JDK-8289551: Conversions between bit representations of half precision values and floats
Joe Darcy
darcy at openjdk.org
Thu Jul 14 21:01:19 UTC 2022
On Thu, 14 Jul 2022 20:54:59 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Float.java line 1100:
>>
>>> 1098:
>>> 1099: // The overflow threshold is binary16 MAX_VALUE + 1/2 ulp
>>> 1100: if (abs_f > (65504.0f + 16.0f) ) {
>>
>> if (abs_f >= (65504.0f + 16.0f) ) {
>>
>> Value exactly halfway must round to infinity.
>
> Good catch. The rest of the code computed the right value, but the condition should be changed as suggested.
I increased test coverage around Binary16.MAX_VALUE+0.5*ulp(Binary16.MAX_VALUE).
-------------
PR: https://git.openjdk.org/jdk/pull/9422
More information about the core-libs-dev
mailing list