Arbitrary-precision rational numbers
The rugint
crate provides arbitrary-precision integers using the
GNU Multiple Precision Arithmetic Library (GMP). It is one
of a group of four crates:
rugint
provides arbitrary-precision integers based on GMP.rugrat
provides arbitrary-precision rational number based on GMP.rugflo
provides arbitrary-precision floating-point numbers based on MPFR.rugcom
provides arbitrary-precision complex numbers based on MPC.
This crate is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. See the full text of the GNU LGPL and GNU GPL for details.
Basic use
Documentation for this crate is available. It can also be helpful to refer to the documentation of the GMP library.
The crate provides the Rational
type, which holds an
arbitrary-precision rational number.
Examples
extern crate rugrat;
use Rational;
Usage
To use rugint
in your crate, add extern crate rugrat;
to the crate
root and add rugrat
as a dependency in Cargo.toml
:
[]
= "0.2.2"
The rugrat
crate depends on the low-level bindings in the
gmp-mpfr-sys
crate. This should be transparent on GNU/Linux and
macOS, but may need some work on Windows. See the gmp-mpfr-sys
documentation for some details.