Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python check equality of floats

# 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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #check #equality #floats
ADD COMMENT
Topic
Name
1+8 =