diff --git a/pyRCV2/numbers/fixed_js.py b/pyRCV2/numbers/fixed_js.py index 7115022..c81b438 100644 --- a/pyRCV2/numbers/fixed_js.py +++ b/pyRCV2/numbers/fixed_js.py @@ -28,7 +28,7 @@ class Fixed: if isinstance(val, Fixed): self.impl = val.impl else: - self.impl = Big(val) + self.impl = Big(val).round(Big.DP) def pp(self, dp): """Pretty print to specified number of decimal places""" diff --git a/pyRCV2/numbers/fixed_py.py b/pyRCV2/numbers/fixed_py.py index e92b72e..5c28ae3 100644 --- a/pyRCV2/numbers/fixed_py.py +++ b/pyRCV2/numbers/fixed_py.py @@ -34,6 +34,8 @@ class Fixed: else: self.impl = Decimal(val).quantize(_quantize_exp) + def __repr__(self): + return ''.format(str(self.impl)) def pp(self, dp): """Pretty print to specified number of decimal places""" return format(self.impl, '.{}f'.format(dp)) diff --git a/pyRCV2/numbers/native_py.py b/pyRCV2/numbers/native_py.py index b4ee3a2..cdbb764 100644 --- a/pyRCV2/numbers/native_py.py +++ b/pyRCV2/numbers/native_py.py @@ -27,6 +27,8 @@ class Native: else: self.impl = float(val) + def __repr__(self): + return ''.format(str(self.impl)) def pp(self, dp): """Pretty print to specified number of decimal places""" return format(self.impl, '.{}f'.format(dp)) diff --git a/pyRCV2/numbers/rational_py.py b/pyRCV2/numbers/rational_py.py index 4720c3f..862915d 100644 --- a/pyRCV2/numbers/rational_py.py +++ b/pyRCV2/numbers/rational_py.py @@ -28,6 +28,8 @@ class Rational: else: self.impl = Fraction(val) + def __repr__(self): + return ''.format(str(self.impl)) def pp(self, dp): """ Pretty print to specified number of decimal places