diff --git a/Packages/Interval_arithmetic/changes.txt b/Packages/Interval_arithmetic/changes.txt index 714c5406462..39cd4f5e539 100644 --- a/Packages/Interval_arithmetic/changes.txt +++ b/Packages/Interval_arithmetic/changes.txt @@ -1,5 +1,8 @@ Changes done to the Interval Arithmetic package. +Version 4.73 on 1 March 2001 +- Alternative to ::rint() as it doesn't exist on... yes yes, Windblows. + Version 4.72 on 25 February 2001 - Declare force_ieee_double_precision in FPU.h. diff --git a/Packages/Interval_arithmetic/src/MP_Float.C b/Packages/Interval_arithmetic/src/MP_Float.C index 0b38bd59942..021f1fbf1d5 100644 --- a/Packages/Interval_arithmetic/src/MP_Float.C +++ b/Packages/Interval_arithmetic/src/MP_Float.C @@ -25,6 +25,17 @@ CGAL_BEGIN_NAMESPACE +inline +int +my_rint(double d) +{ +#if defined __BORLANDC__ || defined _MSC_VER + return int(d<0 ? d-0.5 : d+0.5); +#else + return (int) ::rint(d); +#endif +} + // I use macros because otherwise it's not STD compliant... #define CGAL_MP_FLOAT_TRUNC_MAX (double(base)*(base/2-1)/double(base-1)) #define CGAL_MP_FLOAT_TRUNC_MIN (double(-base)*(base/2)/double(base-1)) @@ -55,7 +66,7 @@ MP_Float::MP_Float(double d) // Then, compute the limbs. v.resize(limbs_per_double); for (int i = limbs_per_double - 1; i > 0; i--) { - v[i] = (limb) ::rint(d); + v[i] = my_rint(d); if (d-v[i] >= double(base/2-1)/(base-1)) v[i]++; d -= v[i]; @@ -67,7 +78,7 @@ MP_Float::MP_Float(double d) remove_trailing_zeros(); - CGAL_expensive_assertion(d == (limb) ::rint(d)); + CGAL_expensive_assertion(d == my_rint(d)); CGAL_assertion(v.back() != 0); CGAL_expensive_assertion(CGAL::to_double(*this) == bak); }