dcmp.cpp 467 B

1234567891011121314151617
  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 = %.10lf", EPS);
  8. registerTestlibCmd(argc, argv);
  9. double ja = ans.readDouble();
  10. double pa = ouf.readDouble();
  11. quitif(!doubleCompare(ja, pa, EPS), _wa, "expected %.10lf, found %.10lf", ja, pa);
  12. quitf(_ok, "answer is %.10lf", ja);
  13. }