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

        use std::fmt::Write;
        let mut j = String::new();
        write!(&mut j, "{}", a)?;

        //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!(fm, "{}", a)?;
    }
    Ok(())
}
///
/// Format an int Formats using either decimal or scientific notation, whichever is shorter.
///
/// If its written in scientific notation, it will do so at the precision specified.
///
/// If the step size is not specified, the number will be formatted
/// with no limit to the precision if scientific mode is picked.
///
Format an int Formats using either decimal or scientific notation, whichever is shorter.
If its written in scientific notation, it will do so at the precision specified.

If the step size is not specified, the number will be formatted
with no limit to the precision if scientific mode is picked.
Format an int Formats using either decimal or scientific notation whichever is shorter . If its written in scientific notation it will do so at the precision specified . If the step size is not specified the number will be formatted with no limit to the precision if scientific mode is picked .
pub fn write_interval_i128<T: fmt::Write>(
    mut fm: T,
    a: i128,
    step: Option<i128>,
) -> std::fmt::Result {
    //TODO handle zero???
    //want to display zero with a formatting that is cosistent with others
    if (a.abs() as f64).log10().floor().abs() > SCIENCE as f64 {
        let mut k = String::new();
        write_science_float(&mut k, a as f64, step.map(|x| x as f64))?;
        use std::fmt::Write;
        let mut j = String::new();
        write!(&mut j, "{}", a)?;
        //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!(fm, "{}", a)?;
    }
    Ok(())
}
pub fn write_interval_i128 < T : fmt :: Write > ( mut fm : T , a : i128 , step : Option < i128 > , ) -> std :: fmt :: Result { //TODO handle zero??? //want to display zero with a formatting that is cosistent with others if ( a . abs ( ) as f64 ) . log10 ( ) . floor ( ) . abs ( ) > SCIENCE as f64 { let mut k = String :: new ( ) ; write_science_float ( & mut k , a as f64 , step . map ( | x | x as f64 ) ) ? ; use std :: fmt :: Write ; let mut j = String :: new ( ) ; write ! ( mut j " " a ) ? ; //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 ! ( fm " " a ) ? ; } Ok ( ( ) ) }
Format an int Formats using either decimal or scientific notation, whichever is shorter.
Format an int Formats using either decimal or scientific notation whichever is shorter .
fm
T
a
i128
step
Option<i128>