Floating point numbers

1.Floatings

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 MPFR library.

#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";

2.Intervals

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";
}

3.Complex numbers

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";
}

4.Balls

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";
}

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License. If you don't have this file, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.