Numerical Standard Library Modules

cmath — standard library module

Complex-valued elementary functions, polar coordinates and classification. Branch-cut results can depend on the sign of zero.

Formal Syntax & Structure

python syntaxpython
import cmath

Return Value

Not applicable

Import binds a module name; individual APIs determine results.

Working Example

Example Snippetpython
import cmathprint(cmath.sqrt(-9))
Python Reference