Блог пользователя lazy_guy_104

Автор lazy_guy_104, история, 18 месяцев назад, По-английски

Hello everyone, I have a doubt regarding precision error problems. For example I wrote a code like here.

Initially the numbers I am multiplying are 2, 10, 10, 10 i.e product should be 2000 but what I get is 1999.

I usually see people use some small value like EPS (10^(-6) or 10^(-10)) in their code. Even while comparing double they do it like abs(a-b)<=EPS, then equal else not. They do not do directly like a!=b.

Please someone explain the above observations and how to effectively take care of it in competitions. Many a times, after passing pretest we fail system tests due to precision errors. What value of EPS (epsilon) do you set or decide from the problem constraints. Please discuss your approach.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится