Module grisu

Source
🔬This is a nightly-only experimental API. (flt2dec)
Expand description

Rust adaptation of the Grisu3 algorithm described in “Printing Floating-Point Numbers Quickly and Accurately with Integers”1. It uses about 1KB of precomputed table, and in turn, it’s very quick for most inputs.


  1. Florian Loitsch. 2010. Printing floating-point numbers quickly and accurately with integers. SIGPLAN Not. 45, 6 (June 2010), 233-243. 

Constants§

ALPHA 👻 Experimental
CACHED_POW10_FIRST_E 👻 Experimental
CACHED_POW10_LAST_E 👻 Experimental
GAMMA 👻 Experimental

Statics§

CACHED_POW10 👻 Experimental

Functions§

cached_power 👻 Experimental
format_exactExperimental
The exact and fixed mode implementation for Grisu with Dragon fallback.
format_exact_optExperimental
The exact and fixed mode implementation for Grisu.
format_shortestExperimental
The shortest mode implementation for Grisu with Dragon fallback.
format_shortest_optExperimental
The shortest mode implementation for Grisu.
max_pow10_no_more_than 👻 Experimental
Given x > 0, returns (k, 10^k) such that 10^k <= x < 10^(k+1).