8 lines
243 B
Python
8 lines
243 B
Python
from decimal import Decimal, ROUND_HALF_UP
|
|
from .types import Numeric
|
|
|
|
|
|
def round_half_up(number: Numeric) -> int:
|
|
""" pythons round() rounds .5 to the *even* number; 0.5 == 0 """
|
|
return int(Decimal(number).to_integral(ROUND_HALF_UP))
|