Arbitrary-precision floating-point numbers
The rugflo crate provides arbitrary-precision floating-point numbers
using the GNU MPFR Library. It is one of a group of four
crates:
rugintprovides arbitrary-precision integers based on GMP.rugratprovides arbitrary-precision rational number based on GMP.rugfloprovides arbitrary-precision floating-point numbers based on MPFR.rugcomprovides 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 MPFR library.
The crate provides the Float type, which provides an
arbitrary-precision floating-point number with correct rounding.
Examples
extern crate rugflo;
use Float;
Usage
To use rugflo in your crate, add extern crate rugflo; to the crate
root and add rugflo as a dependency in Cargo.toml:
[]
= "0.2.2"
The rugflo 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.
Optional feature
The rugflo crate has an optional feature random to enable random
number generation. The random feature introduces a dependency on the
rand crate. The feature is enabled by default; to disable it add
this to Cargo.toml:
[]
= "0.2.2"
= false