Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • round(0.5) == 0, round(1.5) == 2, round(2.5) == 2

    Code Block
    languagepy
    # Hack for intuitive rounding (0.5 -> 1)
    def rounder(number, ndigits=None):
        return round(number + 1e-8, ndigits)

...