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

rounding in between orders of magnitude #9

Open
debrouwere opened this issue Apr 12, 2018 · 1 comment
Open

rounding in between orders of magnitude #9

debrouwere opened this issue Apr 12, 2018 · 1 comment

Comments

@debrouwere
Copy link
Owner

Quantize to somewhere in between a magnitude.

For example:

  • ceil(55.25, 1.2) => 55.26
  • floor(55.25, 1.2) => 55.24
  • round(55.3333, 2.5) => 55.335
  • round(12.345, 1.1) == round(12.345, 2) == 12.34

Note that quantization beyond an order of magnitude results
in a variable amount of decimal digits depending on the
lowest common multiple.

For example:

  • floor(1.2341234, 1.25) == 1.225
  • floor(1.2341234, 1.50) == 1.20
@debrouwere
Copy link
Owner Author

This kind of quantization is often useful when producing charts: when the maximum value is 117K, the axis should preferably go from 0 to 120K or 0 to 125K instead.

Should support round, ceil, floor, min and max.

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