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

The rules listed (1,2,6,7 round down; 3,4,8,9 round up). AFAIK these are also the official Eurozone cash rules for countries that choose not to circulate 1 and 2 eurocent coins. (Altho of course, electronic transactions are exact to the penny.) So you might want to cover this use case.



So basically Math.round((x*20))/20?


Shouldn't it be `round(x/5)*5` ?


Depends, are you working in cents or whole euros/dollars?


In all use-cases I encountered, working with integer cents is much cleaner than decimals




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: