Skip to content

Commit 74ecf6d

Browse files
committed
Fix a rounding error in human readable filesizes
1 parent 13b91cc commit 74ecf6d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/output/render/size.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ impl f::Size {
4141
};
4242

4343
let symbol = prefix.symbol();
44-
let number = if n < 10_f64 { numerics.format_float(n, 1) }
45-
else { numerics.format_int(n as isize) };
46-
44+
let decimal_to_diplay = if n < 10_f64 { 1 } else { 0 };
45+
let number = numerics.format_float(n, decimal_to_diplay);
46+
4747
// The numbers and symbols are guaranteed to be written in ASCII, so
4848
// we can skip the display width calculation.
4949
let width = DisplayWidth::from(number.len() + symbol.len());

0 commit comments

Comments
 (0)