Comment by euroderf

Comment by euroderf a year 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- a year ago

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

  • Silphendio a year ago

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

    • shiandow a year ago

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

      • falcor84 a year ago

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