0

I would like to ask how we can define a and b are actually same after approximation. I like to have True in the following case.

a = 59.9999999
b = 60.0000001
if (a==b):
    print(True)
else:
    print(False)
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Binh Thien
  • 363
  • 2
  • 13

1 Answers1

1
a = 59.9999999
b = 60.0000001
np.isclose([a],[b],atol =a-b)
#op
array([ True])
qaiser
  • 2,770
  • 2
  • 17
  • 29