Comment by euroderf

Comment by euroderf 10 months ago

4 replies

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.

o-o- 10 months ago

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

  • Silphendio 10 months ago

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

    • shiandow 10 months ago

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

      • falcor84 10 months ago

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