Integer and rational numbers

1.Signed integer numbers

Integer numbers of arbitrarily large size are available through the class integer defined in integer.hpp. This class is a simple wrapper to the class mpz_t of the GMP library.

#include<numerix/integer.hpp>
using namespace mmx;
void main () {
  integer a (2), b (3);
  mmout << a * b << "\n";
}

2.Rational numbers

Rational numbers of arbitrarily large size are available through the class rational defined in rational.hpp. This class is a simple wrapper to the class mpq_t of the GMP library.

#include<numerix/rational.hpp>
using namespace mmx;
void main () {
  rational a (2), b (3);
  mmout << a / b << "\n";
}

3.Mathemagix interface

Mmx]  
use "numerix";
type_mode? := true;
Mmx]  
40!

:

Mmx]  
next_prime% 100

:

Mmx]  
prime%? 9973

:

Mmx]  
gcd (10, 35)

:

Mmx]  
10 / 23

:

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.