## CGAL::Lazy_exact_nt<NT>

### Definition

An object of the class Lazy_exact_nt<NT> is able to represent any number which NT is able to represent. The arithmetic operations it can do are those NT can do, limited to the 4 basic operations, the square root and the comparisons. The idea is that Lazy_exact_nt<NT> works exactly like NT, except that it is 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.

In addition to the filtering at each arithmetic operation, the predicates are overloaded in the same way as for Filtered_exact, so you get the additional speed up without requiring to encapsulate Lazy_exact_nt<NT> into Filtered_exact.

#include <CGAL/Lazy_exact_nt.h>

### Is Model for the Concept

FieldNumberType

### Creation

Lazy_exact_nt<NT> m;
| introduces an uninitialized variable m.
Lazy_exact_nt<NT> m ( int i);
| introduces the integral value i.
Lazy_exact_nt<NT> m ( double d);
| introduces the floating point value d (works only if NT has a constructor from a double too).
Lazy_exact_nt<NT> m ( NT n);
| introduces the value n.
template <class NT1>
Lazy_exact_nt<NT> m ( 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).

### Operations

NT | m.exact () | returns the corresponding NT value.
Interval_nt<true> | m.approx () | returns an interval containing the exact value.
Interval_nt<false> | m.interval () | returns an interval containing the exact value.
static void | m.set_relative_precision_of_to_double ( double d)
|  | specifies the relative precision that to_double() has to fulfill. The default value is 10-5. Precondition: d>0 and d<1.
static double | m.get_relative_precision_of_to_double ()
|  | returns the relative precision that to_double() currently fulfills.
std::ostream& | std::ostream& out << m
|  | writes m to ostream out in an interval format.
std::istream& | std::istream& in >> & m
|  | reads a NT from in, then converts it to a Lazy_exact_nt<NT>.

### Example

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

    typedef CGAL::Lazy_exact_nt<CGAL::Quotient<CGAL::MP_Float> > NT;
    typedef CGAL::Cartesian<NT> K;