dcmp.cpp 428 B

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