Repository: sympy/sympy

Issue:
Floor and ceiling functions are returning floats for zero
```python3
>>> floor(float(0))
0.0
>>> ceiling(float(0))
0.0
```

Discussion:

Patch:
diff --git a/sympy/functions/elementary/integers.py b/sympy/functions/elementary/integers.py
index e35eb57135..31a5d25105 100644
--- a/sympy/functions/elementary/integers.py
+++ b/sympy/functions/elementary/integers.py
@@ -21,6 +21,10 @@ class RoundFunction(Function):
     @classmethod
     def eval(cls, arg):
         from sympy import im
+        v = cls._eval_number(arg)
+        if v is not None:
+            return v
+
         if arg.is_integer or arg.is_finite is False:
             return arg
         if arg.is_imaginary or (S.ImaginaryUnit*arg).is_real:
@@ -29,10 +33,6 @@ def eval(cls, arg):
                 return cls(i)*S.ImaginaryUnit
             return cls(arg, evaluate=False)
 
-        v = cls._eval_number(arg)
-        if v is not None:
-            return v
-
         # Integral, numerical, symbolic part
         ipart = npart = spart = S.Zero
 


Test patch:
diff --git a/sympy/functions/elementary/tests/test_integers.py b/sympy/functions/elementary/tests/test_integers.py
index 85f4db8cbe..4b44bb3718 100644
--- a/sympy/functions/elementary/tests/test_integers.py
+++ b/sympy/functions/elementary/tests/test_integers.py
@@ -560,3 +560,8 @@ def test_nested_floor_ceiling():
     assert ceiling(-floor(ceiling(x**3)/y)) == -floor(ceiling(x**3)/y)
     assert floor(ceiling(-floor(x**Rational(7, 2)/y))) == -floor(x**Rational(7, 2)/y)
     assert -ceiling(-ceiling(floor(x)/y)) == ceiling(floor(x)/y)
+
+
+def test_issue_18421():
+    assert floor(float(0)) is S.Zero
+    assert ceiling(float(0)) is S.Zero