Skip to content

Commit

Permalink
Fix Mod._eval_is_integer helper
Browse files Browse the repository at this point in the history
When one cannot determine it is an integer, it should
return None, and not False.  This closes issue sympy/sympy#10024.

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
  • Loading branch information
Dzhelil Rufat authored and skirpichev committed Jul 16, 2016
1 parent a67f188 commit 1461dd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sympy/core/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def doit(p, q):
def _eval_is_integer(self):
from sympy.core.logic import fuzzy_and
p, q = self.args
return fuzzy_and([p.is_integer, q.is_integer, q.is_nonzero])
if fuzzy_and([p.is_integer, q.is_integer, q.is_nonzero]):
return True

def _eval_is_nonnegative(self):
if self.args[1].is_positive:
Expand Down
8 changes: 7 additions & 1 deletion sympy/core/tests/test_assumptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pytest

from sympy import I, sqrt, log, exp, sin, asin
from sympy.core import Symbol, S, Rational, Integer, Dummy, Wild, Pow, Float
from sympy.core import (Symbol, S, Rational, Integer, Dummy,
Wild, Pow, Float, Mod, pi)
from sympy.core.facts import InconsistentAssumptions
from sympy import simplify

Expand Down Expand Up @@ -918,3 +919,8 @@ def test_issue_9165():
assert 0/z == S.NaN
assert 0*(1/z) == S.NaN
assert 0*f == S.NaN


def test_issue_10024():
x = Dummy('x')
assert Mod(x, 2*pi).is_zero is None

0 comments on commit 1461dd4

Please sign in to comment.