Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGZILLA #16657] format.object_size(): Add support for JEDEC units KB, MB, GB (not Kb, Mb, Gb) #6044

Closed
MichaelChirico opened this issue May 18, 2020 · 2 comments

Comments

@MichaelChirico
Copy link
Owner

Created attachment 1992 [details]
Support for JEDEC symbols to utils/R/object.size.R

As a follow up to PR #16649 (implemented in r69869 & r69879) on the IEC standard for binary byte size units (e.g. KiB, MiB, ...), I'd like to add formal support for the JEDEC standard, e.g. KB, MB, and GB. The latter is also a customary standard.

This also brings up the issue with the current units used by R, i.e. Kb, Mb, and Gb. As far as I know, these are not part of any standards. It's especially unfortunate that 'b' is used, because that is standard for 'bit', whereas 'B' is used for 'byte'.

Until a decision is made to drop the history R units/symbols, I propose the attached backward-compatible patch that (in addition to IEC units) now supports output of JEDEC+customary units. This patch should make it easy to transition away from the current R units/symbols and eventually deprecated them if wanted.

Example output:

## R

format(structure(1e8, class = "object_size"), units="Mb")

[1] "95.4 Mb"

## JEDEC (this patch)

format(structure(1e8, class = "object_size"), units="MB")

[1] "95.4 MB"

## IEC (recently added)

format(structure(1e8, class = "object_size"), units="MiB")

[1] "95.4 MiB"

I'm holding back on the Rd patch in case you choose a different route.

For background/my notes, feel free to see HenrikBengtsson/Wishlist-for-R#6

Thank you

Henrik


METADATA

  • Bug author - Henrik Bengtsson
  • Creation time - 2016-01-06 15:48:03 UTC
  • Bugzilla link
  • Status - CLOSED WONTFIX
  • Alias - None
  • Component - Wishlist
  • Version - R-devel (trunk)
  • Hardware - All All
  • Importance - P5 enhancement
  • Assignee - R-core
  • URL -
  • Modification time - 2016-06-03 15:50 UTC
@MichaelChirico
Copy link
Owner Author

I don't have strong opinions on this,
but we should note that this proposal is not full back compatible (outputs will change).

I do have a strong opinion on the SI standard, at least "in general": It is the standard that should come first whereever it applies.
Here we have the problem that the SI standard is different than the JEDEC one,
so I would not want to endorse JEDEC at all.

(see also my comment on your github issue ..)

So, if we change the default output here, and want to follow standards and be unambigous, I think we should "KiB" etc (at least from 'auto')..


METADATA

  • Comment author - Martin Maechler
  • Timestamp - 2016-01-07 16:17:30 UTC

@MichaelChirico
Copy link
Owner Author

I agree that it should be enough to support binary IEC and decimal SI units and adding support for JEDEC is not really needed.

I'm closing this one.


METADATA

  • Comment author - Henrik Bengtsson
  • Timestamp - 2016-06-03 15:50:57 UTC

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

No branches or pull requests

1 participant