round_up¶
- round_up(value, precision=0)[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 (int | str) -- Un-rounded value
precision (float) -- Precision of un-rounded value to consider when rounding
- Returns:
rounded value to given precision away from 0
- Return type:
float