Skip to content

Bug: unit conversion does not work correctly with tebibytes and larger units of memory. #210

@lsauvillers

Description

@lsauvillers

I have the following snippet of code in my typescript project:

const size: Memory = Measure.of(1024, bytes);
const sizeInTebi = size.in(tebi(bytes));
console.log(sizeInTebi);

This produces the output "4 TiB", which is clearly wrong, as 1024 bytes is actually merely 1 KiB. Conversion to kibi, mebi, or gibi work fine, but similar issues also occur with pibi, exbi, zebi and yobi.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions