rncmp.cpp 607 B

123456789101112131415161718192021222324
  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. {
  7. setName("compare two sequences of doubles, maximal absolute error = %.10f", EPS);
  8. registerTestlibCmd(argc, argv);
  9. int n = 0;
  10. while (!ans.seekEof())
  11. {
  12. n++;
  13. double j = ans.readDouble();
  14. double p = ouf.readDouble();
  15. if (fabs(j - p) > EPS + 1E-15)
  16. quitf(_wa, "%d%s numbers differ - expected: '%.10f', found: '%.10f'", n, englishEnding(n).c_str(), j, p);
  17. }
  18. quitf(_ok, "%d numbers", n);
  19. }