// This tests the rounding mode functions. #include #include #include typedef CGAL::Interval_nt_advanced NT_adv; typedef CGAL::Interval_nt<> NT; void print_res (bool res) { std::cout << (res ? "ok" : "ERROR") << std::endl; } // The results of 1-epsilon and -1+epsilon are enough // to detect exactly the current rounding mode. // 1-MIN_DOUBLE // +------+-------+ // | 1 | 1-ulp | // +--------+------+-------+ // -1+MIN_DOUBLE | -1 | near | -inf | // | -1+ulp | +inf | zero | // +--------+------+-------+ // I use a global variable here to avoid constant propagation. double IA_min_double; CGAL::FPU_CW_t FPU_empiric_test() { IA_min_double = CGAL_IA_MIN_DOUBLE; double y = 1.0, z = -1.0; double ye, ze; ye = y - IA_min_double; ze = z + IA_min_double; if (y == ye && z == ze) return CGAL_FE_TONEAREST; if (y == ye) return CGAL_FE_UPWARD; if (z == ze) return CGAL_FE_DOWNWARD; return CGAL_FE_TOWARDZERO; } // This variable is global in order to stop constant propagation. double m = 0.5; CGAL::FPU_CW_t FPU_empiric_test_mul () { int i; for (i=0; i<10; i++) {m*=m; /* std::cout <