1
0

rcmp9.cpp 809 B

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