diff --git a/tabulate.py b/tabulate.py index 9e91f24..b6dd0c5 100644 --- a/tabulate.py +++ b/tabulate.py @@ -995,7 +995,7 @@ def _format(val, valtype, floatfmt, missingval="", has_invisible=True): if is_a_colored_number: print("HIIIIII", val) raw_val = _strip_invisible(val) - formatted_val = format(Decimal(str(raw_val)), floatfmt) + formatted_val = format(float(val), floatfmt) return val.replace(raw_val, formatted_val) else: context = Context(clamp=1, prec=6) @@ -1003,8 +1003,8 @@ def _format(val, valtype, floatfmt, missingval="", has_invisible=True): try: if "f" in floatfmt: if int(Decimal(val)) == Decimal(val): - val = int(Decimal(val, context=context)) - val = Decimal(str(val), context=context) + val = int(Decimal(val)) + val = Decimal(str(val)) else: val = float(val) except (OverflowError, ValueError):