An object of the class MP_Float is able to represent a floating point value with arbitrary precision. This number type has the property that additions, subtractions and multiplications are computed exactly, as well as the construction from a double. Division and square root are computed approximately, so we suggest that you use rationals using Quotient<MP_Float> when you need exact divisions.

Note on the implementation : although the mantissa length is basically only limited by the available memory, the exponent is currently represented by a double, which can overflow in some circumstances. We plan to also have a multiprecision exponent to fix this issue.

#include <CGAL/MP_Float.h>

Is Model for the Concept



MP_Float m;
introduces an uninitialized variable m.

MP_Float m ( MP_Float);
copy constructor.

MP_Float m ( int i);
introduces the integral value i.

MP_Float m ( double d);
introduces the floating point value d.


std::ostream& std::ostream& out << m
writes a double approximation of m to the ostream out.

std::istream& std::istream& in >> & m
reads a double from in, then converts it to an MP_Float.


The implementation of MP_Float is simple but provides a quadratic complexity for multiplications. This can be a problem for large operands. For faster implementations of the same functionality with large integral values, you may want to consider using GMP or LEDA instead.