Skip to content

Commit 9baaaea

Browse files
committed
fix: increase precision of LN_ constants
1 parent 80881ac commit 9baaaea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ const UNITS_IEC: &str = "KMGTPE";
7070
const UNITS_SI: &str = "kMGTPE";
7171

7272
/// `ln(1024) ~= 6.931`
73-
const LN_KIB: f64 = 6.931471806;
73+
const LN_KIB: f64 = 6.931_471_805_599_453;
7474

7575
/// `ln(1000) ~= 6.908`
76-
const LN_KB: f64 = 6.907755279;
76+
const LN_KB: f64 = 6.907_755_278_982_137;
7777

7878
#[derive(Debug, Clone, Default)]
7979
pub enum Format {
@@ -471,7 +471,7 @@ mod tests {
471471
assert_to_string("293.9 KiB", ByteSize::kb(301), Format::IEC);
472472
assert_to_string("301.0 kB", ByteSize::kb(301), Format::SI);
473473

474-
assert_to_string("1024.0 KiB", ByteSize::mib(1), Format::IEC);
474+
assert_to_string("1.0 MiB", ByteSize::mib(1), Format::IEC);
475475
assert_to_string("1.0 MB", ByteSize::mib(1), Format::SI);
476476

477477
assert_to_string("1.9 GiB", ByteSize::mib(1907), Format::IEC);

0 commit comments

Comments
 (0)