-
Notifications
You must be signed in to change notification settings - Fork 194
Closed
Milestone
Description
In [5]: import mpmath
In [6]: import numbers
In [7]: import fractions
In [8]: a = fractions.Fraction(1, 3); isinstance(a, numbers.Rational)
Out[8]: True
In [9]: mpmath.mpf(a)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-e17795c1be20> in <module>
----> 1 mpmath.mpf(a)
/usr/lib/python3/dist-packages/mpmath/ctx_mp_python.py in __new__(cls, val, **kwargs)
75 else:
76 v = new(cls)
---> 77 v._mpf_ = mpf_pos(cls.mpf_convert_arg(val, prec, rounding), prec, rounding)
78 return v
79
/usr/lib/python3/dist-packages/mpmath/ctx_mp_python.py in mpf_convert_arg(cls, x, prec, rounding)
94 return a
95 raise ValueError("can only create mpf from zero-width interval")
---> 96 raise TypeError("cannot create mpf from " + repr(x))
97
98 @classmethod
TypeError: cannot create mpf from Fraction(1, 3)
Metadata
Metadata
Assignees
Labels
No labels