rncmp.cpp 599 B

12345678910111213141516171819202122
  1. #include "testlib.h"
  2. #include <cmath>
  3. using namespace std;
  4. const double EPS = 1.5E-5;
  5. int main(int argc, char *argv[]) {
  6. setName("compare two sequences of doubles, maximal absolute error = %.10f", EPS);
  7. registerTestlibCmd(argc, argv);
  8. int n = 0;
  9. while (!ans.seekEof()) {
  10. n++;
  11. double j = ans.readDouble();
  12. double p = ouf.readDouble();
  13. if (fabs(j - p) > EPS + 1E-15)
  14. quitf(_wa, "%d%s numbers differ - expected: '%.10f', found: '%.10f'", n, englishEnding(n).c_str(), j, p);
  15. }
  16. quitf(_ok, "%d numbers", n);
  17. }