Repository: numpy/numpy
Pull request: BUG: Remove complex floor divide
### Changes:
1. Removed `floor_divide` for all complex types
2. Modified UFuncs `floor_divde` TC to check for `TypeError`. Added same for divmod and remainder.
3. Modified `test_core` to check `TypeError` raised for unsupported types.
4. Removed Typing Tests

### TODO:
- [x] Add release note (Need PR number for this) 

closes: #13236
finishes: #13245 (work done by @kaivu1999)

Problem statement:
np.floor_divide drops imaginary part silently
<!-- Please describe the issue in detail here, and fill in the fields below -->

### Reproducing code example:
```
import numpy as np
a = np.arange(10) + 1j* np.arange(10)
a
# array([0.+0.j, 1.+1.j, 2.+2.j, 3.+3.j, 4.+4.j, 5.+5.j, 6.+6.j, 7.+7.j,
#           8.+8.j, 9.+9.j])
a / 2
# array([0. +0.j , 0.5+0.5j, 1. +1.j , 1.5+1.5j, 2. +2.j , 2.5+2.5j,
#          3. +3.j , 3.5+3.5j, 4. +4.j , 4.5+4.5j])
a // 2
# array([0.+0.j, 0.+0.j, 1.+0.j, 1.+0.j, 2.+0.j, 2.+0.j, 3.+0.j, 3.+0.j,
#          4.+0.j, 4.+0.j])
```
Is there a special reason for this behavior? I would expect to floor_divide the imaginary and complex part.

### Error message:

No error or warning is thrown, not even that imaginary part is getting lost.

### Numpy/Python version information:
1.16.1 
3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0]

Hints from issue discussion:
You can't have a floor function for complex numbers.
[Floor of Complex Numbers](https://math.stackexchange.com/a/2095680/618191)
Also, we don't divide the imaginary part and complex part separately. We get one complex number on dividing 2 complex numbers. ([Dividing complex numbers](http://mathworld.wolfram.com/ComplexDivision.html))

Also ,
`>>> (1. + 1.j) // 2

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't take floor of complex number.`

Similary it should show **TypeError**. 
I am new to open Source. I would like to do it. Can someone guide me ? 


Numpy can't take floor of complex numbers, so instead of giving an error, it simply drops the imaginary part.So I think Numpy is working well
Ok, I thought it would be worth to throw at least a warning, that the imaginary part is dropped, similar to other functions.

Normal python throws an error, seems like we should probably follow suit, unless someone can think of a use case?
Yeah I think we should throw a TypeError.
Can I work on it ?
Personally i would even prefer a (2+2j)//2 = (1+1j), although it's not perfectly mathematically correct.
Not sure what is best, remainder is simply not implemented for complex (throws an error). And if we go to error, maybe we should deprecate first.

Of course you can work on it, it will require to dive a bit into the how ufuncs work and are generated, so it may not be quite trivial, also there may still be some discussion necessary of where we want to go. That does not need to stop you though.
"In the face of ambiguity, refuse the temptation to guess." suggests that it should be a `TypeError`.

@kaivu1999 - to address this, likely best would be to remove the complex types from even being generated in the `floor_divide` ufunc (note that `divmod`, `remainder`, and `modf` are already OK). Look in `core/src/umath/loops.c.src`, in stuff following line 2321 (likely just remove lines 2480--2500).

@mhvk yeah, you also have to adjust `numpy/core/code_generators/generate_umath.py`, but if we want to deprecate first, you will have to create a custom type resolver probably (touches additionally `numpy/core/src/umath/ufunc_type_resolution.c`).
@seberg - it seems the present behaviour should really just be considered a bug, and that for consistency with `remainder` and `divmod`, we should start raising an error.

 Whether we might want different behaviour would seem a separate discussion.

Commit message: BUG, TST: Removed complex floor division cases in typing:reveal

Patch to review:
diff --git a/doc/release/upcoming_changes/19135.change.rst b/doc/release/upcoming_changes/19135.change.rst
new file mode 100644
index 000000000000..0b900a16acc1
--- /dev/null
+++ b/doc/release/upcoming_changes/19135.change.rst
@@ -0,0 +1,10 @@
+Removed floor division support for complex types
+------------------------------------------------
+
+Floor division of complex types will now result in a `TypeError`
+
+.. code-block:: python
+
+    >>> a = np.arange(10) + 1j* np.arange(10)
+    >>> a // 1
+    TypeError: ufunc 'floor_divide' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi
index ac37eb8ad409..0245ffd9a1ce 100644
--- a/numpy/__init__.pyi
+++ b/numpy/__init__.pyi
@@ -2308,8 +2308,6 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
     @overload
     def __floordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ...  # type: ignore[misc]
     @overload
-    def __floordiv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ...  # type: ignore[misc]
-    @overload
     def __floordiv__(self: NDArray[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> NDArray[int64]: ...
     @overload
     def __floordiv__(self: NDArray[timedelta64], other: _ArrayLikeBool_co) -> NoReturn: ...
@@ -2336,8 +2334,6 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
     @overload
     def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> NDArray[floating[Any]]: ...  # type: ignore[misc]
     @overload
-    def __rfloordiv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> NDArray[complexfloating[Any, Any]]: ...  # type: ignore[misc]
-    @overload
     def __rfloordiv__(self: NDArray[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> NDArray[int64]: ...
     @overload
     def __rfloordiv__(self: NDArray[bool_], other: _ArrayLikeTD64_co) -> NoReturn: ...
@@ -3255,8 +3251,6 @@ class complexfloating(inexact[_NBit1], Generic[_NBit1, _NBit2]):
     __rmul__: _ComplexOp[_NBit1]
     __truediv__: _ComplexOp[_NBit1]
     __rtruediv__: _ComplexOp[_NBit1]
-    __floordiv__: _ComplexOp[_NBit1]
-    __rfloordiv__: _ComplexOp[_NBit1]
     __pow__: _ComplexOp[_NBit1]
     __rpow__: _ComplexOp[_NBit1]
 
diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py
index 9e94f9cccc47..1b6917ebc960 100644
--- a/numpy/core/code_generators/generate_umath.py
+++ b/numpy/core/code_generators/generate_umath.py
@@ -329,7 +329,7 @@ def english_upper(s):
           'PyUFunc_DivisionTypeResolver',
           TD(ints, cfunc_alias='divide',
               dispatch=[('loops_arithmetic', 'bBhHiIlLqQ')]),
-          TD(flts + cmplx),
+          TD(flts),
           [TypeDescription('m', FullTypeDescr, 'mq', 'm'),
            TypeDescription('m', FullTypeDescr, 'md', 'm'),
            TypeDescription('m', FullTypeDescr, 'mm', 'q'),
diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src
index 683bd0178bf0..b1afa69a7b80 100644
--- a/numpy/core/src/umath/loops.c.src
+++ b/numpy/core/src/umath/loops.c.src
@@ -2416,42 +2416,6 @@ NPY_NO_EXPORT void
 }
 
 
-NPY_NO_EXPORT void
-@TYPE@_floor_divide(char **args, npy_intp const *dimensions, npy_intp const *steps, void *NPY_UNUSED(func))
-{
-    BINARY_LOOP {
-        const @ftype@ in1r = ((@ftype@ *)ip1)[0];
-        const @ftype@ in1i = ((@ftype@ *)ip1)[1];
-        const @ftype@ in2r = ((@ftype@ *)ip2)[0];
-        const @ftype@ in2i = ((@ftype@ *)ip2)[1];
-#if defined(__APPLE__) && defined(__aarch64__)
-        // On macos-arm64 without this block of code,
-        // when branch prediction goes wrong, the floating point exception
-        // register does not get cleared and an exception for the
-        // wrong branch is thrown.
-        if (in2i == 0) {
-            ((@ftype@ *)op1)[0] = npy_floor@c@(in1r/in2r);
-            ((@ftype@ *)op1)[1] = 0;
-        }
-        else if (in2r == 0) {
-            ((@ftype@ *)op1)[0] = npy_floor@c@(in1i/in2i);
-            ((@ftype@ *)op1)[1] = 0;
-        }
-        else
-#endif
-        if (npy_fabs@c@(in2r) >= npy_fabs@c@(in2i)) {
-            const @ftype@ rat = in2i/in2r;
-            ((@ftype@ *)op1)[0] = npy_floor@c@((in1r + in1i*rat)/(in2r + in2i*rat));
-            ((@ftype@ *)op1)[1] = 0;
-        }
-        else {
-            const @ftype@ rat = in2r/in2i;
-            ((@ftype@ *)op1)[0] = npy_floor@c@((in1r*rat + in1i)/(in2i + in2r*rat));
-            ((@ftype@ *)op1)[1] = 0;
-        }
-    }
-}
-
 /**begin repeat1
  * #kind= greater, greater_equal, less, less_equal, equal, not_equal#
  * #OP = CGT, CGE, CLT, CLE, CEQ, CNE#
diff --git a/numpy/core/src/umath/loops.h.src b/numpy/core/src/umath/loops.h.src
index bb07e047c372..02d749a5eb5b 100644
--- a/numpy/core/src/umath/loops.h.src
+++ b/numpy/core/src/umath/loops.h.src
@@ -420,9 +420,6 @@ C@TYPE@_@kind@(char **args, npy_intp const *dimensions, npy_intp const *steps, v
 NPY_NO_EXPORT void
 C@TYPE@_divide(char **args, npy_intp const *dimensions, npy_intp const *steps, void *NPY_UNUSED(func));
 
-NPY_NO_EXPORT void
-C@TYPE@_floor_divide(char **args, npy_intp const *dimensions, npy_intp const *steps, void *NPY_UNUSED(func));
-
 /**begin repeat1
  * #kind= greater, greater_equal, less, less_equal, equal, not_equal#
  * #OP = CGT, CGE, CLT, CLE, CEQ, CNE#
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 9d1b13b53a86..f438b622aff6 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -418,16 +418,14 @@ def test_zero_division_complex(self):
             assert_(np.isnan(y)[0])
 
     def test_floor_division_complex(self):
-        # check that implementation is correct
-        msg = "Complex floor division implementation check"
+        # check that floor division, divmod and remainder raises type errors
         x = np.array([.9 + 1j, -.1 + 1j, .9 + .5*1j, .9 + 2.*1j], dtype=np.complex128)
-        y = np.array([0., -1., 0., 0.], dtype=np.complex128)
-        assert_equal(np.floor_divide(x**2, x), y, err_msg=msg)
-        # check overflow, underflow
-        msg = "Complex floor division overflow/underflow check"
-        x = np.array([1.e+110, 1.e-110], dtype=np.complex128)
-        y = np.floor_divide(x**2, x)
-        assert_equal(y, [1.e+110, 0], err_msg=msg)
+        with pytest.raises(TypeError):
+            x // 7
+        with pytest.raises(TypeError):
+            np.divmod(x, 7)
+        with pytest.raises(TypeError):
+            np.remainder(x, 7)
 
     def test_floor_division_signed_zero(self):
         # Check that the sign bit is correctly set when dividing positive and
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index b71fa9069f60..a3a109a1c1fa 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -1317,7 +1317,7 @@ def test_minmax_dtypes(self):
                               dtype=float_dtype)
             assert_equal(zm.min(), float_dtype(-np.inf-1j))
             assert_equal(zm.max(), float_dtype(np.inf+2j))
-            
+
             cmax = np.inf - 1j * np.finfo(np.float64).max
             assert masked_array([-cmax, 0], mask=[0, 1]).max() == -cmax
             assert masked_array([cmax, 0], mask=[0, 1]).min() == cmax
@@ -2853,6 +2853,8 @@ def test_inplace_multiplication_array_type(self):
 
     def test_inplace_floor_division_scalar_type(self):
         # Test of inplace division
+        # Check for TypeError in case of unsupported types
+        unsupported = {np.complex64, np.complex128, np.complex256}
         for t in self.othertypes:
             with warnings.catch_warnings(record=True) as w:
                 warnings.filterwarnings("always")
@@ -2860,15 +2862,21 @@ def test_inplace_floor_division_scalar_type(self):
                 x = arange(10, dtype=t) * t(2)
                 xm = arange(10, dtype=t) * t(2)
                 xm[2] = masked
-                x //= t(2)
-                xm //= t(2)
-                assert_equal(x, y)
-                assert_equal(xm, y)
+                try:
+                    x //= t(2)
+                    xm //= t(2)
+                    assert_equal(x, y)
+                    assert_equal(xm, y)
 
-                assert_equal(len(w), 0, "Failed on type=%s." % t)
+                    assert_equal(len(w), 0, "Failed on type=%s." % t)
+                except TypeError:
+                    msg = f"Supported type {t} throwing TypeError"
+                    assert t in unsupported, msg
 
     def test_inplace_floor_division_array_type(self):
         # Test of inplace division
+        # Check for TypeError in case of unsupported types
+        unsupported = {np.complex64, np.complex128, np.complex256}
         for t in self.othertypes:
             with warnings.catch_warnings(record=True) as w:
                 warnings.filterwarnings("always")
@@ -2876,16 +2884,20 @@ def test_inplace_floor_division_array_type(self):
                 m = xm.mask
                 a = arange(10, dtype=t)
                 a[-1] = masked
-                x //= a
-                xm //= a
-                assert_equal(x, y // a)
-                assert_equal(xm, y // a)
-                assert_equal(
-                    xm.mask,
-                    mask_or(mask_or(m, a.mask), (a == t(0)))
-                )
+                try:
+                    x //= a
+                    xm //= a
+                    assert_equal(x, y // a)
+                    assert_equal(xm, y // a)
+                    assert_equal(
+                        xm.mask,
+                        mask_or(mask_or(m, a.mask), (a == t(0)))
+                    )
 
-                assert_equal(len(w), 0, f'Failed on type={t}.')
+                    assert_equal(len(w), 0, f'Failed on type={t}.')
+                except TypeError:
+                    msg = f"Supported type {t} throwing TypeError"
+                    assert t in unsupported, msg
 
     def test_inplace_division_scalar_type(self):
         # Test of inplace division
diff --git a/numpy/typing/tests/data/pass/arithmetic.py b/numpy/typing/tests/data/pass/arithmetic.py
index 62bd79004a11..fe1612906e01 100644
--- a/numpy/typing/tests/data/pass/arithmetic.py
+++ b/numpy/typing/tests/data/pass/arithmetic.py
@@ -191,28 +191,24 @@ def __rpow__(self, value: Any) -> Object:
 AR_b // AR_LIKE_u
 AR_b // AR_LIKE_i
 AR_b // AR_LIKE_f
-AR_b // AR_LIKE_c
 AR_b // AR_LIKE_O
 
 AR_LIKE_b // AR_b
 AR_LIKE_u // AR_b
 AR_LIKE_i // AR_b
 AR_LIKE_f // AR_b
-AR_LIKE_c // AR_b
 AR_LIKE_O // AR_b
 
 AR_u // AR_LIKE_b
 AR_u // AR_LIKE_u
 AR_u // AR_LIKE_i
 AR_u // AR_LIKE_f
-AR_u // AR_LIKE_c
 AR_u // AR_LIKE_O
 
 AR_LIKE_b // AR_u
 AR_LIKE_u // AR_u
 AR_LIKE_i // AR_u
 AR_LIKE_f // AR_u
-AR_LIKE_c // AR_u
 AR_LIKE_m // AR_u
 AR_LIKE_O // AR_u
 
@@ -220,14 +216,12 @@ def __rpow__(self, value: Any) -> Object:
 AR_i // AR_LIKE_u
 AR_i // AR_LIKE_i
 AR_i // AR_LIKE_f
-AR_i // AR_LIKE_c
 AR_i // AR_LIKE_O
 
 AR_LIKE_b // AR_i
 AR_LIKE_u // AR_i
 AR_LIKE_i // AR_i
 AR_LIKE_f // AR_i
-AR_LIKE_c // AR_i
 AR_LIKE_m // AR_i
 AR_LIKE_O // AR_i
 
@@ -235,30 +229,15 @@ def __rpow__(self, value: Any) -> Object:
 AR_f // AR_LIKE_u
 AR_f // AR_LIKE_i
 AR_f // AR_LIKE_f
-AR_f // AR_LIKE_c
 AR_f // AR_LIKE_O
 
 AR_LIKE_b // AR_f
 AR_LIKE_u // AR_f
 AR_LIKE_i // AR_f
 AR_LIKE_f // AR_f
-AR_LIKE_c // AR_f
 AR_LIKE_m // AR_f
 AR_LIKE_O // AR_f
 
-AR_c // AR_LIKE_b
-AR_c // AR_LIKE_u
-AR_c // AR_LIKE_i
-AR_c // AR_LIKE_f
-AR_c // AR_LIKE_c
-
-AR_LIKE_b // AR_c
-AR_LIKE_u // AR_c
-AR_LIKE_i // AR_c
-AR_LIKE_f // AR_c
-AR_LIKE_c // AR_c
-AR_LIKE_O // AR_c
-
 AR_m // AR_LIKE_u
 AR_m // AR_LIKE_i
 AR_m // AR_LIKE_f
@@ -270,7 +249,6 @@ def __rpow__(self, value: Any) -> Object:
 AR_O // AR_LIKE_u
 AR_O // AR_LIKE_i
 AR_O // AR_LIKE_f
-AR_O // AR_LIKE_c
 AR_O // AR_LIKE_O
 
 AR_LIKE_b // AR_O
diff --git a/numpy/typing/tests/data/reveal/arithmetic.py b/numpy/typing/tests/data/reveal/arithmetic.py
index f5d185206c05..0d9132e5becf 100644
--- a/numpy/typing/tests/data/reveal/arithmetic.py
+++ b/numpy/typing/tests/data/reveal/arithmetic.py
@@ -169,28 +169,24 @@
 reveal_type(AR_b // AR_LIKE_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]
 reveal_type(AR_b // AR_LIKE_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_b // AR_LIKE_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
-reveal_type(AR_b // AR_LIKE_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
 reveal_type(AR_b // AR_LIKE_O)  # E: Any
 
 reveal_type(AR_LIKE_b // AR_b)  # E: numpy.ndarray[Any, numpy.dtype[{int8}]]
 reveal_type(AR_LIKE_u // AR_b)  # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]
 reveal_type(AR_LIKE_i // AR_b)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_LIKE_f // AR_b)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
-reveal_type(AR_LIKE_c // AR_b)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
 reveal_type(AR_LIKE_O // AR_b)  # E: Any
 
 reveal_type(AR_u // AR_LIKE_b)  # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]
 reveal_type(AR_u // AR_LIKE_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]
 reveal_type(AR_u // AR_LIKE_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_u // AR_LIKE_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
-reveal_type(AR_u // AR_LIKE_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
 reveal_type(AR_u // AR_LIKE_O)  # E: Any
 
 reveal_type(AR_LIKE_b // AR_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]
 reveal_type(AR_LIKE_u // AR_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]
 reveal_type(AR_LIKE_i // AR_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_LIKE_f // AR_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
-reveal_type(AR_LIKE_c // AR_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
 reveal_type(AR_LIKE_m // AR_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]
 reveal_type(AR_LIKE_O // AR_u)  # E: Any
 
@@ -198,14 +194,12 @@
 reveal_type(AR_i // AR_LIKE_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_i // AR_LIKE_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_i // AR_LIKE_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
-reveal_type(AR_i // AR_LIKE_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
 reveal_type(AR_i // AR_LIKE_O)  # E: Any
 
 reveal_type(AR_LIKE_b // AR_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_LIKE_u // AR_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_LIKE_i // AR_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
 reveal_type(AR_LIKE_f // AR_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
-reveal_type(AR_LIKE_c // AR_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
 reveal_type(AR_LIKE_m // AR_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]
 reveal_type(AR_LIKE_O // AR_i)  # E: Any
 
@@ -213,31 +207,15 @@
 reveal_type(AR_f // AR_LIKE_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
 reveal_type(AR_f // AR_LIKE_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
 reveal_type(AR_f // AR_LIKE_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
-reveal_type(AR_f // AR_LIKE_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
 reveal_type(AR_f // AR_LIKE_O)  # E: Any
 
 reveal_type(AR_LIKE_b // AR_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
 reveal_type(AR_LIKE_u // AR_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
 reveal_type(AR_LIKE_i // AR_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
 reveal_type(AR_LIKE_f // AR_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]
-reveal_type(AR_LIKE_c // AR_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
 reveal_type(AR_LIKE_m // AR_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]
 reveal_type(AR_LIKE_O // AR_f)  # E: Any
 
-reveal_type(AR_c // AR_LIKE_b)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_c // AR_LIKE_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_c // AR_LIKE_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_c // AR_LIKE_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_c // AR_LIKE_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_c // AR_LIKE_O)  # E: Any
-
-reveal_type(AR_LIKE_b // AR_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_LIKE_u // AR_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_LIKE_i // AR_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_LIKE_f // AR_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_LIKE_c // AR_c)  # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]
-reveal_type(AR_LIKE_O // AR_c)  # E: Any
-
 reveal_type(AR_m // AR_LIKE_u)  # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]
 reveal_type(AR_m // AR_LIKE_i)  # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]
 reveal_type(AR_m // AR_LIKE_f)  # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]
@@ -251,7 +229,6 @@
 reveal_type(AR_O // AR_LIKE_u)  # E: Any
 reveal_type(AR_O // AR_LIKE_i)  # E: Any
 reveal_type(AR_O // AR_LIKE_f)  # E: Any
-reveal_type(AR_O // AR_LIKE_c)  # E: Any
 reveal_type(AR_O // AR_LIKE_m)  # E: Any
 reveal_type(AR_O // AR_LIKE_M)  # E: Any
 reveal_type(AR_O // AR_LIKE_O)  # E: Any
@@ -260,7 +237,6 @@
 reveal_type(AR_LIKE_u // AR_O)  # E: Any
 reveal_type(AR_LIKE_i // AR_O)  # E: Any
 reveal_type(AR_LIKE_f // AR_O)  # E: Any
-reveal_type(AR_LIKE_c // AR_O)  # E: Any
 reveal_type(AR_LIKE_m // AR_O)  # E: Any
 reveal_type(AR_LIKE_M // AR_O)  # E: Any
 reveal_type(AR_LIKE_O // AR_O)  # E: Any


Code review comments:
diff_hunk: @@ -2853,39 +2853,51 @@ def test_inplace_multiplication_array_type(self):
 
     def test_inplace_floor_division_scalar_type(self):
         # Test of inplace division
+        # Check for TypeError in case of unsupported types
+        unsupported = {np.complex64, np.complex128, np.complex256}
path: numpy/ma/tests/test_core.py
text: @author:
Ohh seems like `complex256` is not there on all architectures. Will fix this.

@user1:
You can try iterating over [`np.typecodes["Complex"]`](https://github.com/numpy/numpy/blob/9fcc13258960adb94d7dda0b478c0997763d4c4d/numpy/core/numerictypes.py#L537), which will yield the platform-agnostic type-codes of all complex types.

@author:
Thanks! It worked

diff_hunk: @@ -2853,39 +2853,51 @@ def test_inplace_multiplication_array_type(self):
 
     def test_inplace_floor_division_scalar_type(self):
         # Test of inplace division
+        # Check for TypeError in case of unsupported types
+        unsupported = {np.sctypeDict[t] for t in np.typecodes["Complex"]}
path: numpy/ma/tests/test_core.py
text: @user1:
```suggestion
        unsupported = {np.dtype(t).type for t in np.typecodes["Complex"]}
```
Style suggestion; the same applies to `test_inplace_floor_division_array_type`.