示例#1
0
 def __eq__(self, other):
     other = Basic.sympify(other)
     if isinstance(other, NumberSymbol):
         if other.is_irrational: return False
         return other.__eq__(self)
     if other.is_comparable: other = other.evalf()
     if isinstance(other, Number):
         return bool(self._as_decimal()==other._as_decimal())
     return RelMeths.__eq__(self, other)
示例#2
0
 def __eq__(self, other):
     other = Basic.sympify(other)
     if isinstance(other, NumberSymbol):
         if other.is_irrational: return False
         return other.__eq__(self)
     from sympy.core.function import FunctionClass
     if isinstance(self, Number) and isinstance(other, FunctionClass):
         return False
     if other.is_comparable and not isinstance(other, Rational): other = other.evalf()
     if isinstance(other, Number):
         if isinstance(other, Real):
             return bool(self._as_decimal()==other._as_decimal())
         return bool(self.p==other.p and self.q==other.q)
     return RelMeths.__eq__(self, other)
示例#3
0
 def __eq__(self, other):
     other = Basic.sympify(other)
     if self is other: return True
     if isinstance(other, Number) and self.is_irrational: return False
     return RelMeths.__eq__(self, other)