On this page
cmath.isclose
Prev: cmath.exp | Up: cmath | Next: cmath.isfinite
Rel: cmath.acos, cmath.acosh, cmath.asin, cmath.asinh
Ref: docs.python.org — cmath.isclose
Tags: #public #python3 #stdlib #cmath
Import
import cmath
from cmath import isclose
Signature & Overview
cmath.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)
Determine whether two complex numbers are close in value.
Usage
import cmath
assert cmath.isclose(1 + 1e-12j, 1 + 0j, abs_tol=1e-9)
Gotchas
- Always pass
abs_tol=when comparing near0j: Defaultabs_tol=0.0fails against exact zero.
REPL Inspect
from cmath import isclose
help(isclose)
Linked from
Related notes
- tuts/python3/stdlib_module/cmath/exp Linked here; links to this page; shared tags: #cmath, #stdlib
- tuts/python3/stdlib_module/cmath/isfinite Linked here; links to this page; shared tags: #cmath, #stdlib
- tuts/python3/stdlib_module/cmath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/cmath/acos Linked here; shared tags: #cmath, #stdlib
- tuts/python3/stdlib_module/cmath/acosh Linked here; shared tags: #cmath, #stdlib
- tuts/python3/stdlib_module/cmath/asin Linked here; shared tags: #cmath, #stdlib
- tuts/python3/stdlib_module/cmath/asinh Linked here; shared tags: #cmath, #stdlib
- tuts/python3/stdlib_module/cmath/atan shared tags: #cmath, #stdlib
- tuts/python3/stdlib_module/cmath/atanh shared tags: #cmath, #stdlib
- tuts/python3/stdlib_module/cmath/cos shared tags: #cmath, #stdlib