diff --git a/docs/changelog.md b/docs/changelog.md index 6eb2f73..fec264a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,8 @@ # Changelog +## v2.0.2 +- Fixed an issue where large memory prefix functions (`tebi` and up) were using the wrong scalar values. + ## v2.0.0 **Breaking changes** diff --git a/src/unit/memory.ts b/src/unit/memory.ts index 565fce8..3029cb3 100644 --- a/src/unit/memory.ts +++ b/src/unit/memory.ts @@ -9,8 +9,8 @@ export const bytes: Memory = Measure.of(8, bits, "B"); export const kibi: PrefixFn = Measure.prefix("Ki", 1 << 10); export const mebi = Measure.prefix("Mi", 1 << 20); export const gibi = Measure.prefix("Gi", 1 << 30); -export const tebi = Measure.prefix("Ti", 1 << 40); -export const pibi = Measure.prefix("Pi", 1 << 50); -export const exbi = Measure.prefix("Ei", 1 << 60); -export const zebi = Measure.prefix("Zi", 1 << 70); -export const yobi = Measure.prefix("Yi", 1 << 80); +export const tebi = Measure.prefix("Ti", Math.pow(2, 40)); +export const pibi = Measure.prefix("Pi", Math.pow(2, 50)); +export const exbi = Measure.prefix("Ei", Math.pow(2, 60)); +export const zebi = Measure.prefix("Zi", Math.pow(2, 70)); +export const yobi = Measure.prefix("Yi", Math.pow(2, 80));