Skip to content

Instantly share code, notes, and snippets.

@afabri
Created January 25, 2022 08:16
Show Gist options
  • Save afabri/db27a95b2818f63889e6a928d30f6c2e to your computer and use it in GitHub Desktop.
Save afabri/db27a95b2818f63889e6a928d30f6c2e to your computer and use it in GitHub Desktop.
Setting the rounding mode influences output of double
// Produces this output
// https://cgal.geometryfactory.com/CGAL/testsuite/CGAL-5.5-Ic-5/Polynomial/TestReport_Christo_MSVC2017-Debug-64bits.gz
// 3
// 3.0000000000000001
#include <CGAL/Interval_nt.h>
int main() {
double d = 3;
std::cout.precision(17);
std::cout << d << std::endl;
CGAL::Protect_FPU_rounding<true> pfr(CGAL_FE_UPWARD);
std::cout << d << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment