On this page
  1. math.isclose
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

math.isclose

Prev: math.hypot | Up: math | Next: math.isfinite
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.isclose
Tags: #public #python3 #stdlib #math


Import

import math
from math import isclose

Signature & Overview

math.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)

Determine whether two floating-point numbers are close in value.

Usage

import math

assert math.isclose(0.1 + 0.2, 0.3)
assert math.isclose(1e-10, 0.0, abs_tol=1e-9)

Gotchas

REPL Inspect

from math import isclose
help(isclose)

Linked from

Related notes