Expand description
A double-to-string conversion algorithm based on Schubfach and yy.
This Rust implementation is a line-by-line port of Victor Zverovich’s implementation in C++, https://github.com/vitaut/zmij.
§Example
fn main() {
let mut buffer = zmij::Buffer::new();
let printed = buffer.format(1.234);
assert_eq!(printed, "1.234");
}§Performance
The dtoa-benchmark compares this library and other Rust floating point
formatting implementations across a range of precisions. The vertical axis
in this chart shows nanoseconds taken by a single execution of
zmij::Buffer::new().format_finite(value) so a lower result indicates a
faster library.

Modules§
- private 🔒
- stdarch_
x86 🔒 - traits 🔒
Structs§
- Buffer
- Safe API for formatting floating point numbers to text.
- Digits2 🔒
- ExpShift
Table 🔒 - Pow10
Significands 🔒Table - ToDecimal
Result 🔒 - uint128 🔒
Constants§
- BUFFER_
SIZE 🔒 - DIV10K_
EXP 🔒 - DIV10K_
SIG 🔒 - DIV10_
EXP 🔒 - DIV10_
SIG 🔒 - DIV100_
EXP 🔒 - DIV100_
SIG 🔒 - FIXUPS 🔒
- HIGH_
PARTS 🔒 - INFINITY 🔒
- NAN 🔒
- NEG10 🔒
- NEG10K 🔒
- NEG100 🔒
- NEG_
INFINITY 🔒 - POW10S 🔒
- USE_
UMUL128_ 🔒HI64 - ZEROS 🔒
Statics§
Traits§
- Float
- A floating point number, f32 or f64, that can be written into a
zmij::Buffer. - Float
Traits 🔒
Functions§
- compute_
dec_ 🔒exp - compute_
exp_ 🔒 ⚠shift - count_
trailing_ 🔒nonzeros - digits2 🔒 ⚠
- do_
compute_ 🔒exp_ shift - select_
if_ 🔒less - to_bcd8 🔒
- to_
decimal_ 🔒fast - to_
decimal_ 🔒schubfach - umul128 🔒
- umul128_
hi64 🔒 - umul192_
hi128 🔒 - umulhi_
inexact_ 🔒to_ odd - write 🔒 ⚠
- Writes the shortest correctly rounded decimal representation of
valuetobuffer.buffershould point to a buffer of sizebuffer_sizeor larger. - write8 🔒 ⚠
- write_
if 🔒 ⚠ - write_
significand 🔒 ⚠