Crate zmij

Crate zmij 

Source
Expand description

githubcrates-iodocs-rs


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.

performance

Modules§

private 🔒
stdarch_x86 🔒
traits 🔒

Structs§

Buffer
Safe API for formatting floating point numbers to text.
Digits2 🔒
ExpShiftTable 🔒
Pow10SignificandsTable 🔒
ToDecimalResult 🔒
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§

DIGITS2 🔒
EXP_SHIFTS 🔒
POW10_SIGNIFICANDS 🔒

Traits§

Float
A floating point number, f32 or f64, that can be written into a zmij::Buffer.
FloatTraits 🔒

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 value to buffer. buffer should point to a buffer of size buffer_size or larger.
write8 🔒
write_if 🔒
write_significand 🔒