fork(4) download
  1. def checkNumber(x, y, epsilon):
  2. if -epsilon <= x - y <= epsilon:
  3. return True
  4.  
  5. if -epsilon <= x <= epsilon or -epsilon <= y <= epsilon:
  6. return False
  7.  
  8. return (-epsilon <= (x - y) / x <= epsilon
  9. or -epsilon <= (x - y) / y <= epsilon)
  10.  
  11. yours = float('0.4553223e-08')
  12. actual = float('0.0')
  13.  
  14. print checkNumber(yours, actual, 1e-6)
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
True