diff --git a/texttable.py b/texttable.py index cf8e24a..e9bdb68 100644 --- a/texttable.py +++ b/texttable.py @@ -483,11 +483,12 @@ def _fmt_auto(cls, x, **kw): f = cls._to_float(x) if abs(f) > 1e8: fn = cls._fmt_exp + elif f != f: # NaN + fn = cls._fmt_text + elif f - round(f) == 0: + fn = cls._fmt_int else: - if f - round(f) == 0: - fn = cls._fmt_int - else: - fn = cls._fmt_float + fn = cls._fmt_float return fn(x, **kw) def _str(self, i, x):