Skip to content

Conversation

@axyangsio
Copy link

kB vs KB
kB = 1000 bytes where KB = 1024 bytes.

kB vs KB
kB = 1000 bytes where KB = 1024 bytes.
@Mottie
Copy link
Owner

Mottie commented Apr 4, 2018

Hi @axyangsio!

First off, I don't think this change could maintain backwards compatibility.

This enhancement would require adding support for IEC binary values (kibibyte (KiB), mebibyte (MiB), gibibyte (GiB), etc) as well as the JEDEC format as you've started to add above; support for MB and GB should also be included here but I'm not sure how to do it without maintaining backwards compatibility.

I haven't tested it, but I think we could do it by adding the following:

'k|kilo'   : [ 1e3, 1e3 ],
'K|Ki|Kibi|Kilo' : [ 1024, 1024 ],
'Mi|Mebi|mebi' : [ Math.pow(1024, 2), Math.pow(1024, 2) ], // 1024^2
'Gi|Gigi|gigi' : [ Math.pow(1024, 3), Math.pow(1024, 3) ], // 1024^3

The RegLong and RegAbbr would need to be updated with these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants