mirror of https://github.com/CGAL/cgal
- Added ctor(int).
- sqrt -> std::sqrt(). - fixed ulp() declaration. - Added lexicographical_sign_SAF().
This commit is contained in:
parent
af6a1a6b9b
commit
66527a142e
|
|
@ -37,10 +37,18 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
struct Static_filter_error;
|
||||
inline Comparison_result compare_SAF(const Static_filter_error &a,
|
||||
const Static_filter_error &b, double &epsilon);
|
||||
inline Sign sign_SAF(const Static_filter_error &a, double &epsilon);
|
||||
|
||||
struct Static_filter_error
|
||||
{
|
||||
typedef Static_filter_error Sfe;
|
||||
|
||||
Static_filter_error (const int &i)
|
||||
: _b(i), _e(0), _d(1) {}
|
||||
|
||||
Static_filter_error (const double &b, const double &e, const int &d)
|
||||
: _b(b), _e(e), _d(d) {}
|
||||
|
||||
|
|
@ -66,7 +74,7 @@ struct Static_filter_error
|
|||
|
||||
Sfe operator- (const Sfe &f) const { return *this + f; }
|
||||
Sfe operator- () const { return *this; }
|
||||
Sfe operator/ (const Sfe &f) const { abort(); } // Division not supported.
|
||||
Sfe operator/ (const Sfe &) const { abort(); } // Division not supported.
|
||||
|
||||
Sfe& operator+=(const Sfe &f) { return *this = *this + f; }
|
||||
Sfe& operator-=(const Sfe &f) { return *this = *this - f; }
|
||||
|
|
@ -91,7 +99,7 @@ struct Static_filter_error
|
|||
double bound() const { return _b; }
|
||||
int degree() const { return _d; }
|
||||
|
||||
double ulp const (const double &d)
|
||||
double ulp (const double &d) const
|
||||
{
|
||||
// You are supposed to call this function with rounding towards
|
||||
// +infinity, and on a positive number.
|
||||
|
|
@ -117,9 +125,9 @@ sqrt(const Static_filter_error &f)
|
|||
{
|
||||
CGAL_warning_msg(f.degree() & 1 == 0,
|
||||
"you really want a non integer degree ???");
|
||||
double b = sqrt(f.bound());
|
||||
double b = std::sqrt(f.bound());
|
||||
FPU_CW_t backup = FPU_get_and_set_cw(FPU_cw_up);
|
||||
double e = sqrt(f.error()) + f.ulp(b)/2;
|
||||
double e = std::sqrt(f.error()) + f.ulp(b)/2;
|
||||
FPU_set_cw(backup);
|
||||
return Static_filter_error(b, e, f.degree()/2);
|
||||
}
|
||||
|
|
@ -127,6 +135,16 @@ sqrt(const Static_filter_error &f)
|
|||
|
||||
// Now the overloaded built-in predicates, that will _set_ the epsilons.
|
||||
|
||||
inline
|
||||
Sign
|
||||
lexicographical_sign_SAF(const Static_filter_error &,
|
||||
const Static_filter_error &,
|
||||
double &)
|
||||
{
|
||||
// not finished..
|
||||
return ZERO; // ??
|
||||
}
|
||||
|
||||
inline
|
||||
Comparison_result
|
||||
compare_SAF(const Static_filter_error &a,
|
||||
|
|
|
|||
Loading…
Reference in New Issue