Repository: sympy/sympy

Issue:
Floats shouldn't be even, odd or prime in new assumptions
```
In [1]: from sympy import *

In [2]: a = S(1.0)

In [3]: a.is_odd
Out[3]: False

In [4]: ask(Q.odd(a))
Out[4]: True
```

Same goes for even and prime. Composite works fine.


Discussion:

Patch:
diff --git a/sympy/assumptions/ask.py b/sympy/assumptions/ask.py
index 91a15ab5d2..8b4c671748 100644
--- a/sympy/assumptions/ask.py
+++ b/sympy/assumptions/ask.py
@@ -218,8 +218,8 @@ class inheriting from AskHandler::
         ...     # Mersenne numbers are in the form 2**n + 1, n integer
         ...     @staticmethod
         ...     def Integer(expr, assumptions):
-        ...         import math
-        ...         return ask(Q.integer(math.log(expr + 1, 2)))
+        ...         from sympy import log
+        ...         return ask(Q.integer(log(expr + 1, 2)))
         >>> register_handler('mersenne', MersenneHandler)
         >>> ask(Q.mersenne(7))
         True
diff --git a/sympy/assumptions/handlers/ntheory.py b/sympy/assumptions/handlers/ntheory.py
index b7a7955966..8bfba1970e 100644
--- a/sympy/assumptions/handlers/ntheory.py
+++ b/sympy/assumptions/handlers/ntheory.py
@@ -6,7 +6,7 @@
 from sympy.assumptions import Q, ask
 from sympy.assumptions.handlers import CommonHandler
 from sympy.ntheory import isprime
-from sympy.core import S
+from sympy.core import S, Float
 
 
 class AskPrimeHandler(CommonHandler):
@@ -30,7 +30,7 @@ def _number(expr, assumptions):
                 raise TypeError
         except TypeError:
             return False
-        return isprime(i)
+        return isprime(expr)
 
     @staticmethod
     def Basic(expr, assumptions):
@@ -120,6 +120,8 @@ def _number(expr, assumptions):
                 raise TypeError
         except TypeError:
             return False
+        if isinstance(expr, (float, Float)):
+            return False
         return i % 2 == 0
 
     @staticmethod
@@ -207,10 +209,6 @@ def Integer(expr, assumptions):
 
     Rational, Infinity, NegativeInfinity, ImaginaryUnit = [staticmethod(CommonHandler.AlwaysFalse)]*4
 
-    @staticmethod
-    def Float(expr, assumptions):
-        return expr % 2 == 0
-
     @staticmethod
     def NumberSymbol(expr, assumptions):
         return AskEvenHandler._number(expr, assumptions)
diff --git a/sympy/assumptions/handlers/sets.py b/sympy/assumptions/handlers/sets.py
index 770dc210a1..f03a9ebdc6 100644
--- a/sympy/assumptions/handlers/sets.py
+++ b/sympy/assumptions/handlers/sets.py
@@ -83,10 +83,6 @@ def Rational(expr, assumptions):
         # evaluated to Integers
         return False
 
-    @staticmethod
-    def Float(expr, assumptions):
-        return int(expr) == expr
-
     @staticmethod
     def Abs(expr, assumptions):
         return ask(Q.integer(expr.args[0]), assumptions)


Test patch:
diff --git a/sympy/assumptions/tests/test_query.py b/sympy/assumptions/tests/test_query.py
index 9dd5e0e5bf..87a0b5526c 100644
--- a/sympy/assumptions/tests/test_query.py
+++ b/sympy/assumptions/tests/test_query.py
@@ -87,7 +87,7 @@ def test_int_12():
 def test_float_1():
     z = 1.0
     assert ask(Q.commutative(z)) is True
-    assert ask(Q.integer(z)) is True
+    assert ask(Q.integer(z)) is False
     assert ask(Q.rational(z)) is True
     assert ask(Q.real(z)) is True
     assert ask(Q.complex(z)) is True
@@ -96,7 +96,7 @@ def test_float_1():
     assert ask(Q.positive(z)) is True
     assert ask(Q.negative(z)) is False
     assert ask(Q.even(z)) is False
-    assert ask(Q.odd(z)) is True
+    assert ask(Q.odd(z)) is False
     assert ask(Q.finite(z)) is True
     assert ask(Q.infinitesimal(z)) is False
     assert ask(Q.prime(z)) is False
@@ -2218,3 +2218,11 @@ def test_check_old_assumption():
     x = symbols('x', irrational=True)
     assert ask(Q.irrational(x)) is True
     assert ask(Q.rational(x)) is False
+
+
+def test_issue_9636():
+    assert ask(Q.integer(1.0)) is False
+    assert ask(Q.prime(3.0)) is False
+    assert ask(Q.composite(4.0)) is False
+    assert ask(Q.even(2.0)) is False
+    assert ask(Q.odd(3.0)) is False
diff --git a/sympy/ntheory/primetest.py b/sympy/ntheory/primetest.py
index f6805a98d9..60da1a3c95 100644
--- a/sympy/ntheory/primetest.py
+++ b/sympy/ntheory/primetest.py
@@ -204,6 +204,9 @@ def isprime(n):
     sympy.ntheory.generate.prime : Return the nth prime
 
     """
+    from sympy.core.numbers import Float
+    if isinstance(n, (Float, float)):
+        return False
     n = int(n)
     if n < 2:
         return False
diff --git a/sympy/ntheory/tests/test_ntheory.py b/sympy/ntheory/tests/test_ntheory.py
index a9b681790c..cf3652a384 100644
--- a/sympy/ntheory/tests/test_ntheory.py
+++ b/sympy/ntheory/tests/test_ntheory.py
@@ -141,6 +141,7 @@ def test_isprime():
     assert _mr_safe_helper(
         "if n < 3474749660383: return mr(n, [2, 3, 5, 7, 11, 13])") == \
         ' # [2, 3, 5, 7, 11, 13] stot = 7 clear == bases'
+    assert isprime(5.0) is False
 
 
 def test_prime():