Crate pretty_dtoa[][src]

Print floats with many options:

use pretty_dtoa::{dtoa, FmtFloatConfig};

let config = FmtFloatConfig::default()
      .max_decimal_digits(-3)   // cut off at 3 decimals left of the decimal point
      .truncate()               // don't round
      .force_no_e_notation()    // don't use exponential notation
      .add_point_zero(true);    // add a .0 to the end of integer values

assert_eq!(dtoa(123123.0, config), "123000.0");
assert_eq!(dtoa(99999.0, config), "99000.0");

Structs

FmtFloatConfig

Configuration for formatting floats into strings. Look at the associated methods for this type to see default values and specific examples.

Enums

RoundMode

Functions

dtoa

Convert a double-precision floating point value (f64) to a string using a given configuration

ftoa

Convert a single-precision floating point value (f32) to a string using a given configuration