[lworld+fp16] RFR: 8334432: Refine Float16.fma
Jatin Bhateja
jbhateja at openjdk.org
Mon Jul 8 06:18:55 UTC 2024
On Sat, 6 Jul 2024 19:40:16 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> test/jdk/java/lang/Float16/BasicFloat16ArithTests.java line 555:
>>
>>> 553:
>>> 554: {0x1.0p-24f, 0x1.0p-24f, 0x1.0p14f,
>>> 555: 0x1.0p14f},
>>
>> My query was in following context, citing excerpt from JVM Specification 22 section 2.11.3.
>>
>> "The Java Virtual Machine does not indicate overflow or underflow during
>> operations on floating-point data types. That is, floating-point instructions never
>> cause the Java Virtual Machine to throw a run-time exception (not to be confused
>> with an IEEE 754 floating-point exception). **An operation that overflows produces
>> a signed infinity; an operation that underflows produces a subnormal value or a
>> signed zero;** an operation that has no unique mathematically defined result produces
>> NaN. All numeric operations with NaN as an operand produce NaN as a result"
>
>> My query was in following context, citing excerpt from JVM Specification 22 section 2.11.3.
>>
>> "The Java Virtual Machine does not indicate overflow or underflow during operations on floating-point data types. That is, floating-point instructions never cause the Java Virtual Machine to throw a run-time exception (not to be confused with an IEEE 754 floating-point exception). **An operation that overflows produces a signed infinity; an operation that underflows produces a subnormal value or a signed zero;** an operation that has no unique mathematically defined result produces NaN. All numeric operations with NaN as an operand produce NaN as a result"
>
> Sure; that is reasonable.
>
> The correctness of the Float16.fma method relies on the correctness of the double to Float16 conversion. As part of a larger test update, I was planned on expanding the double to Float16 testing. In particular, a test methodology like:
>
> For each finite Float16 value, test the double values around the half-way point to make sure the rounding is correct in those cases. Since there are so few Float16 values, I expect this test to run quickly.
Thanks again for explanation. sounds good to me. Yes full range of value are indeed covered in above exhaustive test including lowest sub-normal value (0x1.000P-24 == 0x0.004P-14 == 5.960464477539063E-8
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1143#discussion_r1668048039
More information about the valhalla-dev
mailing list