Nedy88's blog

By Nedy88, 13 years ago, In English

All of us use epsilons in their codes for problems dealing with floating point numbers. Do you have some method of choosing what the value of epsilon to use or use some fixed number. I just solve an old geometry problem: 8D - Two Friends and when I used eps = 1e-9 I failed systests, but when I made eps = 1e-10 my solution passed. This is not the first time I fail because of choosing inappropriate value of eps and I was wondering if you guys use some methods of choosing the value.

PS: In this problem I mainly use epsilon to write a < b + esp instead of a <= b.

  • Vote: I like it
  • +35
  • Vote: I do not like it

»
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Shouldn't it be a + eps < b instead of a < b + eps ?

  • »
    »
    13 years ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    For a <= b it should be a <= b + EPS
    For a < b it should be a + EPS < b

    • »
      »
      »
      13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Ok, I've read a < b instead of a <= b. My bad.

»
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Here's a problem of round 100 ->(problem) that had the problem of epsilon handling...The authors editorial explained about it -(editorial) but I could not understand it...Maybe you top guys can infer something...Then do tell me also :)