RFR: JDK-8289551: Conversions between bit representations of half precision values and floats

Joe Darcy darcy at openjdk.org
Wed Jul 13 06:06:24 UTC 2022


On Fri, 8 Jul 2022 06:11:22 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Initial implementation.

Some notes in the current implementation in the PR: the impetus for the change is to provide a minimal level of platform support for the binary16 floating-point format defined in IEEE 754. This is done by added two methods to Float, one for binary16 -> float conversion and the other for float -> binary16 conversion. In the absence of the ability to define primitive types, short is used as a carrier for the bits of a binary16 value.

The conversion code in its current form favors readability over speed; a more performant software implementation may be possible even without intrinsification.

A different 16-bit floating-point format, bfloat, is popular in some circles. Any similar support for bfloat will be left for future work.

Please also review the companion CSR: https://bugs.openjdk.org/browse/JDK-8290216

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

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


More information about the core-libs-dev mailing list