fn pretty_bytes(num: f64) -> String {
    let negative = if num < 0.0 { "-" } else { "" };
    let num = num.abs();

    const UNITS: &[&str] = &["B", "kB", "MB", "GB", "TB"];
    if num < 1.0 {
        return format!("{}{} {}", negative, num, "B");
    }
    let v1 = (num.ln() / 1024_f64.ln()).floor() as i32;
    let exponent = cmp::min(v1, 4_i32);
    let pretty_bytes = format!("{:.2}", num / 1024_f64.powi(exponent));
    let unit: &str = UNITS[exponent as usize];

    format!("{}{} {}", negative, pretty_bytes, unit)
}
/// pretty_bytes gets a value in bytes and returns a human-readable form of it
pretty_bytes gets a value in bytes and returns a human-readable form of it
pretty_bytes gets a value in bytes and returns a human - readable form of it
fn pretty_bytes(num: f64) -> String {
    let negative = if num < 0.0 { "-" } else { "" };
    let num = num.abs();
    const UNITS: &[&str] = &["B", "kB", "MB", "GB", "TB"];
    if num < 1.0 {
        return format!("{}{} {}", negative, num, "B");
    }
    let v1 = (num.ln() / 1024_f64.ln()).floor() as i32;
    let exponent = cmp::min(v1, 4_i32);
    let pretty_bytes = format!("{:.2}", num / 1024_f64.powi(exponent));
    let unit: &str = UNITS[exponent as usize];
    format!("{}{} {}", negative, pretty_bytes, unit)
}
fn pretty_bytes ( num : f64 ) -> String { let negative = if num < 0.0 { " " } else { " " } ; let num = num . abs ( ) ; const UNITS : & [ & str ] = & [ " " , " " , " " , " " , " " ] ; if num < 1.0 { return format ! ( " " negative num " " ) ; } let v1 = ( num . ln ( ) / 1024_f64 . ln ( ) ) . floor ( ) as i32 ; let exponent = cmp :: min ( v1 , 4_i32 ) ; let pretty_bytes = format ! ( " " num 1024_f64 powi ( exponent ) ) ; let unit : & str = UNITS [ exponent as usize ] ; format ! ( " " negative pretty_bytes unit ) }
pretty_bytes gets a value in bytes and returns a human-readable form of it
pretty_bytes gets a value in bytes and returns a human - readable form of it
num
f64
num
f64