Floating point numbers |
Floating point numbers of arbitrarily large size are available through
the class floating defined in floating.hpp. This class is a simple wrapper to the
class mpfr_t of the
#include<numerix/floating.hpp>
using namespace mmx;
void main () {
floating<> a (2), b (3);
mmout << a * b << "\n";
}
The precision can be set thanks to the global variable mmx_bit_precision.
Lower and upper certified approximates can be obtained as follows:
typedef rounding_helper<floating<> >::UV Up;
typedef rounding_helper<floating<> >::DV Down;
mmout << Up::sqrt (floating<> (2)) << "\n";
mmout << Down::sqrt (floating<> (2)) << "\n";
Interval are implemented within the class interval defined in interval.hpp.
#include<numerix/floating.hpp>
#include<numerix/interval.hpp>
using namespace mmx;
typedef interval<floating<> > Interval;
void main () {
Interval a (2), b (3.0, 3.1);
mmout << a * b << "\n";
}
Complex numbers are available through the class complex defined in complex.hpp. Over double one must include numerix/complex_double.hpp.
#include<numerix/complex_double.hpp>
using namespace mmx;
typedef complex<double> Complex;
void main () {
Complex a (2), b (3.0, 0.1);
mmout << a * b << "\n";
}
Balls are implemented in the class ball defined in ball.hpp.
#include<numerix/ball.hpp>
using namespace mmx;
typedef ball<floating<> > Ball;
void main () {
Ball a (2), b (3.0, 0.1);
mmout << a * b << "\n";
}