Skip to main content

digits_to_exp_str

Function digits_to_exp_str 

Source
fn digits_to_exp_str<'a>(
    buf: &'a [u8],
    exp: i16,
    frac_digits: usize,
    upper: bool,
    parts: &'a mut [MaybeUninit<Part<'a>>],
) -> &'a [Part<'a>]
🔬This is a nightly-only experimental API. (flt2dec)
Expand description

Formats the given decimal digits 0.<...buf...> * 10^exp into the exponential form with at least the given number of fractional digits. When upper is true, the exponent will be prefixed by E; otherwise that’s e. The result is stored to the supplied parts array and a slice of written parts is returned.

frac_digits can be less than the number of actual fractional digits in buf; it will be ignored and full digits will be printed. It is only used to print additional zeroes after rendered digits. Thus, frac_digits == 0 means that it will only print the given digits and nothing else.

For example, buf = b"123", exp = 3, frac_digits = 4 yields the parts for 1.2300e2.