Skip to content

Bug: Binary prefix and SI prefix incorrectly used for byte ('B').  #251

Description

@andrewmtoy

I was trying to convert a quantity from B to MB and I got an unexpected result.

console.log(math.format(math.eval('5000000 B to MB'), 14))
Result:  4.7683715820313 MB

I was expecting to see 5MB.

I saw in the documentation, units.md, that SI prefixes such as kilo, mega, giga, etc. have the same value as their IEC counterparts kibi, mebi, gibi, etc.

According to IEC, this is incorrect. Their definitions for kibibyte and kilobyte are as follows.

The definition of the kibibyte is:
1 kibibyte = 210 bytes = 1024 bytes.

The definition of the kilobyte is:
1 kB = 1000bytes = 10^3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions