gtg922r / obsidian-numerals

An obsidian plugin which turns a math code block into a full featured calculator
Other
389 stars 7 forks source link

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

Open equivocates opened 3 months ago

equivocates commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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.