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

For currency, allow users to round to an arbitrary number of decimal places #75

Open
equivocates opened this issue May 15, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@equivocates
Copy link

equivocates commented May 15, 2024

Currently, sometimes the results round to the nearest tenth. Sometimes, it rounds to the nearest 100th. Ideally, the user should be allowed to set what decimal place a currency result rounds to.

To be clear, numbers should format as follows if the user sets rounding to two (2) decimal places:

120 => 120.00 USD
120.1 => 120.10 USD
120.32 => 120.32 USD
120.35 => 120.36 USD
120.3499 => 120.34 USD

@gtg922r gtg922r added the enhancement New feature or request label May 25, 2024
@gtg922r
Copy link
Owner

gtg922r commented May 25, 2024

How important is it to be able to set the rounding, vs just make sure that it rounds to the convention? e.g. do you ever want to see 4 decimals of USD, or is two decimals the most you want to see because thats the convention?

Do you have a particular use case? (it helps me prioritize feature inclusion)

@equivocates
Copy link
Author

equivocates commented May 25, 2024

For my personal purposes, I always use 2 decimal places for currency. But, for example, I see gas stations sell gas to the hundredth of a cent. I suggested rounding to an arbitrary decimal place because I assume other industries sometimes use different numerals.

However, I suspect I am in the vast majority who prefer rounding currency to two decimal places.

For whatever it's worth, I was able to find the mathjs documentation on this issue -- see the examples section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants