lib-misc-utils · crate
kinogaki-float-text
The shortest decimal text that reads back as the same f64, fast.
- Repository
- lib-misc-utils (kinogaki/lib-misc-utils)
- Folder
libs/lib-misc-utils/crates/float-text- Source
- 4 files, 993 lines
- Tests
- 3 files, 313 lines
What it is
The shortest decimal text that reads back as the same f64, fast.
The digits are the shortest that round-trip, and of those the closest to the exact value (ties to even): the same digits as Rust's {:e} (tests/against_std.rs) except at exact ties, where we round to even (as Ryu and zmij do), and the text is zmij's byte for byte. The digits come from one 128-bit scaling (src/shortest.rs), written eight at a time. The text is plain decimal when the value's scientific exponent E is in -5..=15 (123.456, 0.00001, always with a .: 1.0), and d.ddde±E outside (1.5e+16, 1e-6).
Depends on
None.
Third-party
None.
Used by
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-obj | OBJ | normal | Wavefront OBJ, a format plugin: an OBJ file reads as one standard Geometry, its material libraries (mtllib) as MaterialX networks (materials) in a materials item before it; any polygons and polylines write as ... |
Modules
digits(private)Sixteen ASCII digits at a time: two numbers below 10^8 to two little-endian words of eight digits, inu64arithmetic.27 linesshortest(private)The shortest decimal that rounds back to a finite, positive f64, with one 128 × 64-bit product (the method zmij uses, after Xiang JunBo's refinement of Schubfach).120 linestables(private)Generated by tools/generate.py; do not edit.628 lines
Public types and traits
At the crate root
Structs FloatText
