- round
Floating point -compare using round
examples/numbers/float_precision_rounded.py
x = 0.1 + 0.2 y = 0.3 print(x) # 0.30000000000000004 print(y) # 0.3 print(round(x, 10)) if round(x, 10) == round(y, 10): print("They are equal") else: print("They are NOT equal")