DOMjudge / domjudge

DOMjudge programming contest jury system
https://www.domjudge.org
GNU General Public License v2.0
709 stars 248 forks source link

compare.cc incorrect formatting of long double values #182

Closed wmacevoy closed 8 years ago

wmacevoy commented 8 years ago

When comparing floats; the diagnostic output is incorrect. For example using an abs error of 0.1 on input DOMJudge 5.0.1 reports:

Wrong answer on line 570 of output (corresponding to line 570 in answer file) Too large difference. Judge: 3964.5 Team: 3964.4 Difference: 2.332414e-310 (abs tol 2.332414e-310 rel tol 2.332414e-310)

The solution is to replace %le with %Le in the format string (line 177):

domjudge-5.0.1/sql/files/defaultdata/compare/compare.cc:

wrong_answer("Too large difference.\n Judge: %s\n Team: %s\n Difference: %Le\n (abs tol %Le rel tol %Le)",

eldering commented 8 years ago

Thanks for the report. Coincidentally, I had also noticed this during the UKIEPC contest. It is fixed in 7661186f02da00df8cbc33b9f18bca14f3174c16 in the 5.0 branch.