From c4fb9bcfe1604fb24761ca5b2ac1e8ac507e02a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 4 Nov 2015 10:59:20 +0100 Subject: [PATCH] improve comment --- Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h b/Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h index 1c8b44c9f6d..5a9e567cb02 100644 --- a/Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h +++ b/Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h @@ -70,7 +70,10 @@ public: NT x_floor = std::floor(CGAL::to_double(x_tmp)); NT y_floor = std::floor(CGAL::to_double(y_tmp)); - //fix the double floor + // fix the usage of to_double and floor: + // there is no guarantee that the double approximation of *_tmp + // has the same integer part as the NT version. The while loops + // is a simple way to ensure that *_tmp are the true floor. while(x_floor>x_tmp) x_floor-=NT(1); while(y_floor>y_tmp) y_floor-=NT(1); while(x_floor+1<=x_tmp) x_floor+=NT(1);