Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you're the one settling the books at your bank, sure. If you just need to display the price of something, a float+money formatter is mostly fine.


Mostly. You might be surprised how much of a headache it creates when things are off by a little in ways customers don't understand even when you're not settling transactions like that. Customers get confused when they get receipts or invoices where things don't add up, even when it saves them a penny! I've seen rounding down make people mad because it didn't add up when discounts were applied even when they were the benefit of the extra cent. Obviously rounding up makes people mad out of principle because it's adding cost that wasn't agreed upon.


I have left another comment. A trillion times this. Floats anywhere give two outcomes: customer accuses you of salami slicing from them or you give away millions.


Every so often, someone shares a picture where NaN got printed onto a price sticker.




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

Search: