\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.7 - Number Types
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Lazy_exact_nt< NT > Class Template Reference

#include <CGAL/Lazy_exact_nt.h>

Definition

An object of the class Lazy_exact_nt<NT> is able to represent any real embeddable number which NT is able to represent.

The idea is that Lazy_exact_nt<NT> works exactly like NT, except that it is expected to be faster because it tries to only compute an approximation of the value, and only refers to NT when needed. The goal is to speed up exact computations done by any exact but slow number type NT.

Template Parameters
NTmust be a model of concept RealEmbeddable, and at least model of concept IntegralDomainWithoutDivision.

Note that some filtering mechanism is available at the predicate level using Filtered_predicate and Filtered_kernel.

Is Model Of:

IntegralDomainWithoutDivision same as NT

RealEmbeddable

Fraction, if NT is a Fraction

Example

#include <CGAL/Cartesian.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &out, const Lazy_exact_nt< NT > &m)
 writes m to ostream out in an interval format. More...
 
std::istream & operator>> (std::istream &in, Lazy_exact_nt< NT > &m)
 reads a NT from in, then converts it to a Lazy_exact_nt<NT>. More...
 

Creation

 Lazy_exact_nt ()
 introduces an uninitialized variable m. More...
 
 Lazy_exact_nt (BuiltIn i)
 introduces the value x, of any built-in arithmetic type (int, double, etc) (works only if NT has a constructor from this type too). More...
 
 Lazy_exact_nt (NT n)
 introduces the value n. More...
 
template<class NT1 >
 Lazy_exact_nt (Lazy_exact_nt< NT1 > n)
 introduces the value n. More...
 

Operations

NT exact ()
 returns the corresponding NT value. More...
 
Interval_nt< true > approx ()
 returns an interval containing the exact value. More...
 
Interval_nt< false > interval ()
 returns an interval containing the exact value. More...
 
static void set_relative_precision_of_to_double (double d)
 specifies the relative precision that to_double() has to fulfill. More...
 
static double get_relative_precision_of_to_double ()
 returns the relative precision that to_double() currently fulfills. More...
 

Constructor & Destructor Documentation

template<typename NT >
CGAL::Lazy_exact_nt< NT >::Lazy_exact_nt ( )

introduces an uninitialized variable m.

template<typename NT >
CGAL::Lazy_exact_nt< NT >::Lazy_exact_nt ( BuiltIn  i)

introduces the value x, of any built-in arithmetic type (int, double, etc) (works only if NT has a constructor from this type too).

template<typename NT >
CGAL::Lazy_exact_nt< NT >::Lazy_exact_nt ( NT  n)

introduces the value n.

template<typename NT >
template<class NT1 >
CGAL::Lazy_exact_nt< NT >::Lazy_exact_nt ( Lazy_exact_nt< NT1 >  n)

introduces the value n.

NT1 needs to be convertible to NT (and this conversion will only be done if necessary).

Member Function Documentation

template<typename NT >
Interval_nt<true> CGAL::Lazy_exact_nt< NT >::approx ( )

returns an interval containing the exact value.

template<typename NT >
NT CGAL::Lazy_exact_nt< NT >::exact ( )

returns the corresponding NT value.

template<typename NT >
static double CGAL::Lazy_exact_nt< NT >::get_relative_precision_of_to_double ( )
static

returns the relative precision that to_double() currently fulfills.

template<typename NT >
Interval_nt<false> CGAL::Lazy_exact_nt< NT >::interval ( )

returns an interval containing the exact value.

template<typename NT >
static void CGAL::Lazy_exact_nt< NT >::set_relative_precision_of_to_double ( double  d)
static

specifies the relative precision that to_double() has to fulfill.

The default value is \( 10^{-5}\).

Precondition
d>0 and d<1.

Friends And Related Function Documentation

template<typename NT >
std::ostream & operator<< ( std::ostream &  out,
const Lazy_exact_nt< NT > &  m 
)
related

writes m to ostream out in an interval format.

template<typename NT >
std::istream & operator>> ( std::istream &  in,
Lazy_exact_nt< NT > &  m 
)
related

reads a NT from in, then converts it to a Lazy_exact_nt<NT>.