Function core::num::flt2dec::to_exact_exp_str [] [src]

pub fn to_exact_exp_str<'a, T, F>(format_exact: F, v: T, sign: Sign, ndigits: usize, upper: bool, buf: &'a mut [u8], parts: &'a mut [Part<'a>]) -> Formatted<'a> where T: DecodableFloat, F: FnMut(&Decoded, &mut [u8], i16) -> (usize, i16)
Unstable (flt2dec)

: internal routines only exposed for testing

Formats given floating point number into the exponential form with exactly given number of significant digits. The result is stored to the supplied parts array while utilizing given byte buffer as a scratch. upper is used to determine the case of the exponent prefix (e or E). The first part to be rendered is always a Part::Sign (which can be an empty string if no sign is rendered).

format_exact should be the underlying digit-generation function. You probably would want strategy::grisu::format_exact for this.

The byte buffer should be at least ndigits bytes long unless ndigits is so large that only the fixed number of digits will be ever written. (The tipping point for f64 is about 800, so 1000 bytes should be enough.) There should be at least 7 parts available, due to the worst case like [+][1][.][2345][e][-][67].