round_up¶
- round_up(value: int | str, precision: float = 0) float[source]¶
Round to given precision away from zero.
Example: >>> [round_up(a) for a in [-1.5, -1.1, -0.5, 0.5, 1.1, 1.5]] [-2.0, -2.0, -1.0, 1.0, 2.0, 2.0]
>>> [round_up(a, 1) for a in [-1.25, -1.15, 1.15, 1.25]] [-1.3, -1.2, 1.2, 1.3]
- Parameters:
value -- Un-rounded value
precision -- Precision of un-rounded value to consider when rounding
- Returns:
rounded value to given precision away from 0