17 lines
315 B
Python
17 lines
315 B
Python
import sys
|
|
|
|
|
|
def float_eps_equal(val, should_val):
|
|
"""
|
|
True: gdw. Wert und der Zielwert liegen weniger als die maximale Fehler aneinander.
|
|
"""
|
|
eps = sys.float_info.epsilon
|
|
return abs(val - should_val) <= eps
|
|
|
|
|
|
calc = 1.1 - 1
|
|
if float_eps_equal(calc, 0.1):
|
|
print(True)
|
|
else:
|
|
print(False)
|