Python membandingkan pelampung
import numpy as np
np.isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)
Intempestive Al Dente
import numpy as np
np.isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)
# credit to the Stack Overflow user in the source link
# method of the 'math' module
def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):
return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)