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
  • 221,139
  • 17
  • 121
  • 189
Binh Thien
  • 269
  • 2
  • 12

1 Answers1

1
a = 59.9999999
b = 60.0000001
np.isclose([a],[b],atol =a-b)
#op
array([ True])
qaiser
  • 2,351
  • 2
  • 14
  • 24