Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
#34341 : fix bool(x^2 + 2*x + 1 != (x + 1)^2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry Monteil committed Aug 11, 2022
1 parent 12be2d9 commit 5ca40a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/sage/symbolic/expression.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,11 @@ cdef class Expression(Expression_abc):
sage: val = pi - 2286635172367940241408/1029347477390786609545*sqrt(2)
sage: bool(val>0)
False
Check that :trac:`34341` is fixed::
sage: bool(x^2 + 2*x + 1 != (x + 1)^2)
False
"""
if self.is_relational():
# constants are wrappers around Sage objects, compare directly
Expand Down Expand Up @@ -3499,8 +3504,8 @@ cdef class Expression(Expression_abc):

# Use interval fields to try and falsify the relation
if not need_assumptions:
if pynac_result == relational_notimplemented and self.operator()==operator.ne:
return not (self.lhs()-self.rhs()).is_trivial_zero()
if pynac_result == relational_notimplemented and self.operator() == operator.ne:
return not (self.lhs()-self.rhs()).is_zero()
res = self.test_relation()
if res in (True, False):
return res
Expand Down

0 comments on commit 5ca40a8

Please sign in to comment.