In addition to my comment, math.isclose uses abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) which is commutative, but at the cost of an additional operation (which could be costly for numpy arrays which need to be stacked in order to find the maximum). It isn't hard to implement your own if you really require this property:

def isclose_comm(a, b, rtol=1e-5, atol=1e-8):
   ab = np.stack((a, b))
   return np.abs(a - b) <= (atol + rtol * ab.max(axis=0))

x = np.random.random(5)

x
Out[94]: array([0.36007049, 0.86934972, 0.05827216, 0.60794612, 0.24539454])

y = x + np.random.random(5)/1e6

y
Out[96]: array([0.36007072, 0.86934976, 0.05827312, 0.6079464 , 0.24539492])

np.isclose(x, y)
Out[97]: array([ True,  True,  False,  True,  True])

isclose_comm(x, y)
Out[98]: array([ True,  True,  True,  True,  True])

z = np.zeros(5)

isclose_comm(x, z)
Out[100]: array([False, False, False, False, False])

allclose equivelent:

def allclose_comm(a, b, rtol=1e-5, atol=1e-8):
    return isclose_comm(a, b, rtol, atol).all()
Answer from FHTMitchell on Stack Overflow
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.allclose.html
numpy.allclose — NumPy v2.1 Manual
allclosebool · Returns True if the two arrays are equal within the given tolerance; False otherwise. See also · isclose, all, any, equal ·
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.isclose.html
numpy.isclose — NumPy v2.1 Manual
The default value of atol is not appropriate when the reference value b has magnitude smaller than one. For example, it is unlikely that a = 1e-9 and b = 2e-9 should be considered “close”, yet isclose(1e-9, 2e-9) is True with default settings.
🌐
NumPy
numpy.org › doc › 1.25 › reference › generated › numpy.allclose.html
numpy.allclose — NumPy v1.25 Manual
allclosebool · Returns True if the two arrays are equal within the given tolerance; False otherwise. See also · isclose, all, any, equal · Notes · If the following equation is element-wise True, then allclose returns True. absolute(a - b) <= (atol + rtol * absolute(b)) The above equation is not symmetric in a and b, so that allclose(a, b) might be different from allclose(b, a) in some rare cases.
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.allclose.html
numpy.allclose — NumPy v2.4 Manual
allclosebool · Returns True if the two arrays are equal within the given tolerance; False otherwise. See also · isclose, all, any, equal ·
🌐
Python Pool
pythonpool.com › home › blog › numpy isclose explained with examples in python
NumPy isclose Explained with examples in Python - Python Pool
June 14, 2021 - This primarily because while the isclose function returns the Boolean for every single element after comparing. But in the second case the where we use allclose, we get a single Boolean value for any number of elements after comparing.
🌐
GitHub
github.com › numpy › numpy › issues › 10161
numpy.isclose vs math.isclose · Issue #10161 · numpy/numpy
December 5, 2017 - numpy.isclose (https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.isclose.html): abs(a - b) <= (atol + rtol * abs(b)) math.isclose (https://docs.python.org/3/library/math.html#math.isclose): abs(a - b) <= max(rtol * max(abs(a), abs(b)), atol) Note that Numpy's equation is not symmetric and correlates the atol and rtol parameters, both are bad things (IMO).
Author   gasparka
🌐
YouTube
youtube.com › coderide
numpy isclose vs allclose - YouTube
Download 1M+ code from https://codegive.com **understanding numpy's isclose vs allclose: a quick guide**numpy, a powerful library for numerical computing in...
Published   November 18, 2024
Views   1
Find elsewhere
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.allclose.html
numpy.allclose — NumPy v2.5.dev0 Manual
allclosebool · Returns True if the two arrays are equal within the given tolerance; False otherwise. See also · isclose, all, any, equal ·
🌐
CmdLineTips
cmdlinetips.com › home › numpy allclose() function with examples
Numpy allclose() function with examples - Python and R Tips
January 4, 2023 - However the big difference between Numpy’s isclose() and allclose() function is that Numpy’s isclose() return a boolean vector with TRUE/FALSE values for element-wise comparison. For example, if we are comparing two arrays of length N, we will get a boolean vector of length N, with True for elements that are close and False otherwise.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-allclose-in-python
numpy.allclose() in Python - GeeksforGeeks
December 9, 2025 - np.allclose(a1, a2, rtol=1e-05, atol=1e-08) compares elements using absolute and relative tolerance. Returns True because differences are within allowed tolerance. numpy.allclose(arr1, arr2, rtol=1e-05, atol=1e-08, equal_nan=False)
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.isclose.html
numpy.isclose — NumPy v2.3 Manual
The default value of atol is not appropriate when the reference value b has magnitude smaller than one. For example, it is unlikely that a = 1e-9 and b = 2e-9 should be considered “close”, yet isclose(1e-9, 2e-9) is True with default settings.
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.isclose.html
numpy.isclose — NumPy v2.4 Manual
The default value of atol is not appropriate when the reference value b has magnitude smaller than one. For example, it is unlikely that a = 1e-9 and b = 2e-9 should be considered “close”, yet isclose(1e-9, 2e-9) is True with default settings.
🌐
JAX Documentation
docs.jax.dev › en › latest › _autosummary › jax.numpy.isclose.html
jax.numpy.isclose — JAX documentation
jax.numpy.isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)[source]# Check if the elements of two arrays are approximately equal within a tolerance. JAX implementation of numpy.allclose(). Essentially this function evaluates the following condition: \[|a - b| \le \mathtt{atol} + \mathtt{rtol} * |b|\] jnp.inf in a will be considered equal to jnp.inf in b.
🌐
JAX Documentation
docs.jax.dev › en › latest › _autosummary › jax.numpy.allclose.html
numpy.allclose() - JAX documentation - Read the Docs
jax.numpy.isclose() jax.numpy.equal() Examples · >>> jnp.allclose(jnp.array([1e6, 2e6, 3e6]), jnp.array([1e6, 2e6, 3e7])) Array(False, dtype=bool) >>> jnp.allclose(jnp.array([1e6, 2e6, 3e6]), ... jnp.array([1.00008e6, 2.00008e7, 3.00008e8]), rtol=1e3) Array(True, dtype=bool) >>> jnp.allclose(jnp.array([1e6, 2e6, 3e6]), ...
🌐
SciPy
docs.scipy.org › doc › › numpy-1.9.2 › reference › generated › numpy.isclose.html
numpy.isclose — NumPy v1.9 Manual
numpy.isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)[source]¶ · Returns a boolean array where two arrays are element-wise equal within a tolerance. The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(b)) and the absolute difference atol are added together to compare against the absolute difference between a and b. See also · allclose ·
🌐
NumPy
numpy.org › doc › 1.25 › reference › generated › numpy.isclose.html
numpy.isclose — NumPy v1.25 Manual
Unlike the built-in math.isclose, the above equation is not symmetric in a and b – it assumes b is the reference value – so that isclose(a, b) might be different from isclose(b, a). Furthermore, the default value of atol is not zero, and is used to determine what small values should be ...
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.isclose.html
numpy.isclose — NumPy v2.5.dev0 Manual
The default value of atol is not appropriate when the reference value b has magnitude smaller than one. For example, it is unlikely that a = 1e-9 and b = 2e-9 should be considered “close”, yet isclose(1e-9, 2e-9) is True with default settings.