Search code examples
pythondivisioncomplex-numberspython-3.6floor-division

Python 3.6: Floor division of a complex number


I need to floor divide a complex number, but it appears that floor division by complex numbers was removed in Python 3.x.

Is there any workarounds for this? Any ideas would be appreciated.

eg.

(2 + 3i) // (complex anything) will throw an error.

Solution

  • I just found the mpmath library. It has large amount of tools, including floor and mod for complex numbers. It appears that its actually included with SymPy.