Example #1
0
 def __lt__(self, other):
     try:
         other = _sympify(other)
     except SympifyError:
         return False    # sympy > other
     if isinstance(other, NumberSymbol):
         return other.__ge__(self)
     if other.is_comparable: other = other.evalf()
     if isinstance(other, Number):
         return bool(mlib.mpf_lt(self._mpf_, other._as_mpf_val(self._prec)))
     return Basic.__lt__(self, other)
Example #2
0
 def __lt__(self, other):
     try:
         other = _sympify(other)
     except SympifyError:
         return False    # sympy > other
     if isinstance(other, NumberSymbol):
         return other.__ge__(self)
     if other.is_comparable: other = other.evalf()
     if isinstance(other, Number):
         return bool(mlib.mpf_lt(self._mpf_, other._as_mpf_val(self._prec)))
     return Basic.__lt__(self, other)
Example #3
0
 def __lt__(self, other):
     try:
         other = _sympify(other)
     except SympifyError:
         return False    # sympy > other  --> not <
     if isinstance(other, NumberSymbol):
         return other.__ge__(self)
     if other.is_comparable and not isinstance(other, Rational): other = other.evalf()
     if isinstance(other, Number):
         if isinstance(other, Real):
             return bool(mlib.mpf_lt(self._as_mpf_val(other._prec), other._mpf_))
         return bool(self.p * other.q < self.q * other.p)
     return Basic.__lt__(self, other)
Example #4
0
 def __lt__(self, other):
     try:
         other = _sympify(other)
     except SympifyError:
         return False    # sympy > other  --> not <
     if isinstance(other, NumberSymbol):
         return other.__ge__(self)
     if other.is_comparable and not isinstance(other, Rational): other = other.evalf()
     if isinstance(other, Number):
         if isinstance(other, Real):
             return bool(mlib.mpf_lt(self._as_mpf_val(other._prec), other._mpf_))
         return bool(self.p * other.q < self.q * other.p)
     return Basic.__lt__(self, other)
Example #5
0
 def __lt__(self, other):
     try:
         other = _sympify(other)
     except SympifyError:
         return False    # sympy > other  --> not <
     if self is other: return False
     if isinstance(other, Number):
         approx = self.approximation_interval(other.__class__)
         if approx is not None:
             l,u = approx
             if other < l: return False
             if other > u: return True
         return self.evalf()<other
     if other.is_comparable:
         other = other.evalf()
         return self.evalf()<other
     return Basic.__lt__(self, other)
Example #6
0
 def __lt__(self, other):
     try:
         other = _sympify(other)
     except SympifyError:
         return False    # sympy > other  --> not <
     if self is other: return False
     if isinstance(other, Number):
         approx = self.approximation_interval(other.__class__)
         if approx is not None:
             l,u = approx
             if other < l: return False
             if other > u: return True
         return self.evalf()<other
     if other.is_comparable:
         other = other.evalf()
         return self.evalf()<other
     return Basic.__lt__(self, other)