dcmp.cpp 481 B

12345678910111213141516171819
  1. #include "testlib.h"
  2. #include <stdio.h>
  3. #include <math.h>
  4. const double EPS = 1E-6;
  5. int main(int argc, char * argv[])
  6. {
  7. setName("compare two doubles, maximal absolute or relative error = %.10f", EPS);
  8. registerTestlibCmd(argc, argv);
  9. double ja = ans.readDouble();
  10. double pa = ouf.readDouble();
  11. if (!doubleCompare(ja, pa, EPS))
  12. quitf(_wa, "expected %.10f, found %.10f", ja, pa);
  13. quitf(_ok, "answer is %.10f", ja);
  14. }