pub fn write_interval_float<T: fmt::Write>(
    mut fm: T,
    a: f64,
    step: Option<f64>,
) -> std::fmt::Result {
    //TODO handle zero???
    //want to display zero with a formatting that is cosistent with others
    if a.abs().log10().floor().abs() > SCIENCE as f64 {
        let mut k = String::new();
        write_science_float(&mut k, a, step)?;

        let mut j = String::new();
        write_normal_float(&mut j, a, step)?;

        //Even if we use scientific notation,
        //it could end up as more characters
        //because of the needed precision.
        let ans = if k.len() < j.len() { k } else { j };
        write!(fm, "{}", ans)?;
    } else {
        write_normal_float(fm, a, step)?;
    }
    Ok(())
}
///
/// Format a f64 with the specified precision. Formats using
/// either decimal or scientific notation, whichever is shorter.
///
/// The step amount dictates the precision we need to show at each interval
/// in order to capture the changes from each step
///
/// If the step size is not specified, the number will be formatted
/// with no limit to the precision.
///
Format a f64 with the specified precision. Formats using
either decimal or scientific notation, whichever is shorter.

The step amount dictates the precision we need to show at each interval
in order to capture the changes from each step

If the step size is not specified, the number will be formatted
with no limit to the precision.
Format a f64 with the specified precision . Formats using either decimal or scientific notation whichever is shorter . The step amount dictates the precision we need to show at each interval in order to capture the changes from each step If the step size is not specified the number will be formatted with no limit to the precision .
pub fn write_interval_float<T: fmt::Write>(
    mut fm: T,
    a: f64,
    step: Option<f64>,
) -> std::fmt::Result {
    //TODO handle zero???
    //want to display zero with a formatting that is cosistent with others
    if a.abs().log10().floor().abs() > SCIENCE as f64 {
        let mut k = String::new();
        write_science_float(&mut k, a, step)?;
        let mut j = String::new();
        write_normal_float(&mut j, a, step)?;
        //Even if we use scientific notation,
        //it could end up as more characters
        //because of the needed precision.
        let ans = if k.len() < j.len() { k } else { j };
        write!(fm, "{}", ans)?;
    } else {
        write_normal_float(fm, a, step)?;
    }
    Ok(())
}
pub fn write_interval_float < T : fmt :: Write > ( mut fm : T , a : f64 , step : Option < f64 > , ) -> std :: fmt :: Result { //TODO handle zero??? //want to display zero with a formatting that is cosistent with others if a . abs ( ) . log10 ( ) . floor ( ) . abs ( ) > SCIENCE as f64 { let mut k = String :: new ( ) ; write_science_float ( & mut k , a , step ) ? ; let mut j = String :: new ( ) ; write_normal_float ( & mut j , a , step ) ? ; //Even if we use scientific notation, //it could end up as more characters //because of the needed precision. let ans = if k . len ( ) < j . len ( ) { k } else { j } ; write ! ( fm " " ans ) ? ; } else { write_normal_float ( fm , a , step ) ? ; } Ok ( ( ) ) }
Format a f64 with the specified precision.
Format a f64 with the specified precision .
fm
T
a
f64
step
Option<f64>