Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mvadari committed Apr 14, 2022
1 parent 07e9ef6 commit fdefde6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tabulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,16 +995,16 @@ 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)
setcontext(context)
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):
Expand Down

0 comments on commit fdefde6

Please sign in to comment.