mirror of https://github.com/CGAL/cgal
- Added a #if 0'd out preliminary version of to_interval().
This commit is contained in:
parent
f262fb010e
commit
4e75aa3f61
|
|
@ -27,6 +27,15 @@ CGAL_BEGIN_NAMESPACE
|
|||
|
||||
// Fixed is in fact a float => trivial conversion.
|
||||
|
||||
#if 0
|
||||
inline
|
||||
Interval_base
|
||||
to_interval (const Fixed_precision_nt & z)
|
||||
{
|
||||
return CGAL::to_double(z);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
Interval_nt_advanced
|
||||
convert_from_to (const Interval_nt_advanced&, const Fixed_precision_nt & z)
|
||||
|
|
|
|||
|
|
@ -31,9 +31,21 @@ CGAL_BEGIN_NAMESPACE
|
|||
// We choose the lazy approach, which is good enough: we take the double
|
||||
// approximation, which is guaranted 1 bit error max (when rounding to
|
||||
// nearest), and return an interval around this value.
|
||||
// It should be much faster to have a low level function especially designed
|
||||
// It could be better to have a low level function especially designed
|
||||
// for that using rounding to infinity.
|
||||
|
||||
#if 0
|
||||
inline // better in libCGAL...
|
||||
Interval_base
|
||||
to_interval(const Gmpz & z)
|
||||
{
|
||||
Protect_FPU_rounding<> P(CGAL_FE_TONEAREST);
|
||||
Interval_nt_advanced approx (CGAL::to_double(z));
|
||||
FPU_set_cw(CGAL_FE_UPWARD);
|
||||
return approx + Interval_base::Smallest;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
Interval_nt_advanced
|
||||
convert_from_to (const Interval_nt_advanced&, const Gmpz & z)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
#if 0
|
||||
template <class RT>
|
||||
inline
|
||||
Interval_base
|
||||
to_interval (const Lazy_exact_nt<RT> & z)
|
||||
{
|
||||
return z.approx();
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class RT>
|
||||
inline
|
||||
Interval_nt_advanced
|
||||
|
|
|
|||
|
|
@ -28,8 +28,17 @@ CGAL_BEGIN_NAMESPACE
|
|||
// We don't know anything about the internal RT type, so there is a risk of
|
||||
// overflow, but we can't do better than the following trivial conversion.
|
||||
|
||||
#if 0
|
||||
template <class RT>
|
||||
Interval_base
|
||||
to_interval (const Quotient<RT> & z)
|
||||
{
|
||||
return Interval_nt<>(CGAL::to_interval(z.numerator())) /
|
||||
Interval_nt<>(CGAL::to_interval(z.denominator()));
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class RT>
|
||||
inline
|
||||
Interval_nt_advanced
|
||||
convert_from_to (const Interval_nt_advanced&, const Quotient<RT> & z)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,6 +29,18 @@ CGAL_BEGIN_NAMESPACE
|
|||
// approximation, which is guaranted 1 bit error max(?), and return an
|
||||
// interval around this value (+/- ulp).
|
||||
|
||||
#if 0
|
||||
inline // hum...
|
||||
Interval_base
|
||||
to_interval (const leda_bigfloat & z)
|
||||
{
|
||||
Protect_FPU_rounding<> P (CGAL_FE_TONEAREST);
|
||||
Interval_nt_advanced approx (::to_double(z));
|
||||
FPU_set_cw(CGAL_FE_UPWARD);
|
||||
return approx + Interval_base::Smallest;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
Interval_nt_advanced
|
||||
convert_from_to (const Interval_nt_advanced&, const leda_bigfloat & z)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,18 @@ CGAL_BEGIN_NAMESPACE
|
|||
// LEDA integer's internal representation, which is not possible without
|
||||
// modifying LEDA.
|
||||
|
||||
#if 0
|
||||
inline // ?
|
||||
Interval_base
|
||||
to_interval (const leda_integer & z)
|
||||
{
|
||||
Protect_FPU_rounding<> P (CGAL_FE_TONEAREST);
|
||||
Interval_nt_advanced approx (z.to_double());
|
||||
FPU_set_cw(CGAL_FE_UPWARD);
|
||||
return approx + Interval_base::Smallest;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
Interval_nt_advanced
|
||||
convert_from_to (const Interval_nt_advanced&, const leda_integer & z)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,20 @@ CGAL_BEGIN_NAMESPACE
|
|||
// conversion. Since LEDA types (except real) don't give information on the
|
||||
// precision of to_double(), we can't do much...
|
||||
|
||||
#if 0
|
||||
inline // well, at that point... big fat function.
|
||||
Interval_base
|
||||
to_interval (const leda_rational & z)
|
||||
{
|
||||
Protect_FPU_rounding<> P (CGAL_FE_TONEAREST);
|
||||
Interval_nt_advanced approx (z.to_double());
|
||||
FPU_set_cw(CGAL_FE_UPWARD);
|
||||
|
||||
return ( (approx + Interval_base::Smallest) + Interval_base::Smallest)
|
||||
+ Interval_base::Smallest;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
Interval_nt_advanced
|
||||
convert_from_to (const Interval_nt_advanced&, const leda_rational & z)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,19 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
#if 0
|
||||
inline // hum...
|
||||
Interval_base
|
||||
to_interval (const leda_real & z)
|
||||
{
|
||||
Protect_FPU_rounding<> P (CGAL_FE_TONEAREST);
|
||||
double approx = z.to_double();
|
||||
double rel_error = z.get_double_error();
|
||||
FPU_set_cw(CGAL_FE_UPWARD);
|
||||
return ( Interval_nt_advanced(-rel_error,rel_error) + 1 ) * approx;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
Interval_nt_advanced
|
||||
convert_from_to (const Interval_nt_advanced&, const leda_real & z)
|
||||
|
|
|
|||
Loading…
Reference in New Issue