Hacker News new | past | comments | ask | show | jobs | submit login

Absolutely agreed! And a more nuanced approach is what Stripe does, which is to take the "zero-decimal-currency" as the unit of record, be that USD cents or the non-subdivisible JPY. https://stripe.com/docs/currencies#zero-decimal

But in that case, and especially in that case, in any system that might interact with, say, a UI where a field is in decimal USD, Stripe needs to be careful about which things are price_decimal and price_zerodecimal. Unless you have a near-religious fervor that all variables not annotated with _decimal are assumed to be _zerodecimal, in such a situation one might go so far as to auto-reject any PR that does not suffix all variables explicitly. Because the alternative is hard-to-detect 100x-off bugs that occur when battle-tested systems/libraries are reused in different contexts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: