doubleCompare in testlib.h

Правка en1, от maroonrk, 2021-06-13 12:41:32

After the last ARC, one participant pointed out that the result is WA when the error is precisely the same as $$$EPS$$$ (submission).

For example, consider these two outputs: 331997010.50000000000000000000 (the jury output) and 331997342.4970105 (the user output). Their relative error is exactly $$$10^{-6}$$$, so when $$$EPS=10^{-6}$$$, this should get AC.

However, with the current implementation of the doubleCompare function in testlib.h, the result is WA. This is because perturbations in the line 429 (return result + 1E-15 >= minv && result <= maxv + 1E-15;) don't work when the values of result/minv/maxv are large. We made a fix and sent a pull request.

If you believe you were affected by this in the last ARC, please let me know.

That being said, given the popularity of testlib.h and the fact that no one has ever raised this issue, I hope no one was affected by this in the entire history of testlib.h.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский maroonrk 2021-06-13 12:41:32 1064 Initial revision (published)