Skip to content

Grisu2 floating point printing implementation in Java (with zero garbage overhead).

License

Notifications You must be signed in to change notification settings

jnordwick/zerog-grisu

Repository files navigation

A Java implementation of the Florian Loitsch's Grisu2 algorithm for printing
floating point numbers with only integer arithmetic. Fast and always correct,
even if not the shortest :)

No garbage is created per call. Possibly a little on startup.

http://florian.loitsch.com/publications
https://github.com/floitsch/double-conversion

Author's Node: This is not very Java-ish code. It uses some hacks to make sure
everything gets done in native types and no garbage is created and to work
around Java's lack of unsigned integers. All these could be solved if Java
had no-overhead value objects on the stack. Valhalla is working on them I
hear, but that is a Java 10 feature at the earliest :(

COMPILING:

The project has JMH jar references to my maven repo. If that causes problems,
you can remove them and test/zerog/util.grisu/JmhBenchmark.java from the build.

About

Grisu2 floating point printing implementation in Java (with zero garbage overhead).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages