Re:What's the right way to handle monetary values in code?
by count on Thursday March 24, 2011 @06:16PM
(#2366267)
But which method is appropriate for financial code?
[ Parent
| on HN ]
Re:What's the right way to handle monetary values in code?
by abeld on Thursday March 24, 2011 @06:25PM
(#2366286)
I would use whichever errs in favor of the customer. Its only one cent, after all.
Re:What's the right way to handle monetary values in code?
by mooism2 on Thursday March 24, 2011 @06:35PM
(#2366312)
If full price is £9.99 and you've got it on offer at £5.00, that's less than 50% off. If you want to say you're offering it at 50% off, you need to price it at £4.99.
In banking, I believe the convention is to round to the nearest penny, and round half-pennies to the nearest even penny.