From d84df2b9fb5478b0a8a26d483f5a1fc89a7e7abc Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Wed, 21 Feb 2001 14:26:14 +0000 Subject: [PATCH] - Don't use the Rel Ops. - Avoid static data member const double. --- .../include/CGAL/MP_Float.h | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Packages/Interval_arithmetic/include/CGAL/MP_Float.h b/Packages/Interval_arithmetic/include/CGAL/MP_Float.h index 36f672067c7..84f09c3936b 100644 --- a/Packages/Interval_arithmetic/include/CGAL/MP_Float.h +++ b/Packages/Interval_arithmetic/include/CGAL/MP_Float.h @@ -27,7 +27,7 @@ #include #include #include -#include +// #include #include #include @@ -64,6 +64,10 @@ CGAL_BEGIN_NAMESPACE class MP_Float; double to_double(const MP_Float &); +// 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)) + class MP_Float { public: @@ -74,8 +78,9 @@ public: static const unsigned log_limb = 8*sizeof(limb); static const limb2 base = 1< V; typedef V::const_iterator const_iterator; @@ -114,12 +119,13 @@ public: // First, find the exponent. exp = 1 - limbs_per_double; - while (d < trunc_min || d > trunc_max) { + while (d < CGAL_MP_FLOAT_TRUNC_MIN || d > CGAL_MP_FLOAT_TRUNC_MAX) { exp++; d *= 1.0/base; } - while (d >= trunc_min/base && d <= trunc_max/base) { + while (d >= CGAL_MP_FLOAT_TRUNC_MIN/base + && d <= CGAL_MP_FLOAT_TRUNC_MAX/base) { exp--; d *= base; } @@ -176,6 +182,21 @@ public: bool operator<(const MP_Float &) const; + bool operator>(const MP_Float &f) const + { + return f<*this; + } + + bool operator>=(const MP_Float &f) const + { + return !(*thisf); + } + bool operator==(const MP_Float &b) const { return (v == b.v) && ((exp == b.exp) || v.empty());