On Wed, 13 Jul 2022 12:28:29 GMT, Raffaello Giulietti <d...@openjdk.org> wrote:

>> Initial implementation.
>
> src/java.base/share/classes/java/lang/Float.java line 1090:
> 
>> 1088:     public static short floatToBinary16AsShortBits(float f) {
>> 1089:         if (Float.isNaN(f)) {
>> 1090:             // Arbitrary binary16 NaN value; could try to preserve the
> 
> // Arbitrary binary16 quiet NaN value; could try to preserve the

I double-checked the 754-2019 standard; unlike in some earlier versions of the 
standard, the 2019 edition does specify how a quiet vs signaling NaN is 
supposed to be encoded. Quoting from section 6.2.1:

"A quiet NaN bit string should be encoded with the first bit (d1) of the 
trailing significand
field T being 1. A signaling NaN bit string should be encoded with the first 
bit of the trailing significand
field being 0."

So the NaN bit pattern used is a quiet NaN.

In any case, I'll update this code to more faithfully pass along the bits of a 
Float NaN.

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

PR: https://git.openjdk.org/jdk/pull/9422

Reply via email to