Skip to content

io7m-com/ieee754b16

Repository files navigation

ieee754b16

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.ieee754b16

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

ieee754b16

Java functions to convert to and from the IEEE754 binary16 type.

Features

  • Conversion between double/float and binary16 values.
  • High coverage test suite (100%, minus an unreachable private constructor).
  • OSGi-ready
  • JPMS-ready
  • ISC license.

Usage

The package uses the char type to store values of the binary16 type. To convert a double-precision value 32.0 to binary16 format:

final char k = Binary16.packDouble(32.0);

To unpack values from the binary16 format:

final double r = Binary16.unpackDouble(k);