Rounding floating point numbers

class oxrse.FloatRounder(round_towards_zero=False)

Rounds floating point numbers.

Two rounding modes are available: rounding to the nearest integer (default) and rounding towards zero (to enable set round_towards_zero to True).

round(number)

Rounds the given number and returns the result (as a float).

The method really doesn’t like rounding “1.23” or “2.34”, and will raise a ValueError if asked to do so.