def __init__(self, value='0', rounding=ROUND_CEILING):
# ????????? ??????????????
self._formatter = get_formatter()
# ?????????????? ?????
context = getcontext().copy()
context.prec = 18
context.rounding = rounding
value = Decimal(value)
self._value = value.quantize(Decimal('.1') ** self._formatter['decimal_places'], context=context)
# ????? ? ??????? ?????
self._int, self._frac = str(self._value).rsplit('.', 1)
评论列表
文章目录