On Wed, 8 Jul 2026 10:09:35 GMT, Raffaello Giulietti <[email protected]> 
wrote:

>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16Vector.java
>>  line 3716:
>> 
>>> 3714:      * produces a human-readable floating-point value and canonical 
>>> text
>>> 3715:      * for special values (for example {@code "NaN"} and {@code 
>>> "Infinity"})
>>> 3716:      * regardless of the underlying bit encoding.
>> 
>> It occurred to me there is a simpler way;
>> 
>>      * The string is produced as if by a call to {@link
>>      * java.util.Arrays#toString(double[]) Arrays.toString()},
>>      * as appropriate to the {@code double} array returned by
>>      * {@link #toArray this.toDoubleArray()}.
>>  ```
>> Internally we can reuse `toFloat16Array`, but you can also use 
>> `toDoubleArray`, they should be equivalent. @jddarcy can you confirm this is 
>> the case?
>
> @PaulSandoz Yes, the note by @jddarcy is correct, and the proposal by 
> @jatin-bhateja makes much more sense than using `double`s for the purpose of 
> this PR.

Oh, well too good to be true :-) in that case I suggest the following more 
concise definition:


/*
 * The string is produced as if by a call to {@link
 * java.util.Arrays#toString(Object[]) Arrays.toString()},
 * as appropriate to a {@code Float16} array whose elements
 * are obtained by applying {@link Float16#shortBitsToFloat16(short)}
 * to each element of the {@code short[]} array returned by
 * {@link #toArray this.toArray()}.
 */

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31800#discussion_r3545309278

Reply via email to