Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 2.62 KB

README.md

File metadata and controls

50 lines (36 loc) · 2.62 KB

jnfp

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.jnfp

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)

jnfp

Java functions to convert between floating point and normalized fixed point values.

Features

  • Conversion between unsigned normalized fixed-point numbers and floating point numbers.
  • Conversion between signed normalized fixed-point numbers and floating point numbers.
  • High coverage test suite.
  • OSGi-ready
  • JPMS-ready
  • ISC license.

Usage

Convert a floating point value to its 32-bit unsigned normalized fixed point representation:

var r = NFPUnsignedFloatLong.toUnsignedNormalized(0.25, 32);

Convert a 32-bit unsigned normalized fixed point value to its floating point representation:

var s = NFPUnsignedFloatLong.fromUnsignedNormalized(r, 32);

Classes exist for signed, unsigned, int, long, float, and double specializations.