Multiple precision floating point numbers implemented purely in Rust.
Rationale
There are several notable implementations of numbers with increased precision for Rust. Among the libraries, one can recall num-bigint, rust_decimal.
While these libraries are great in many ways, they don't allow you to perform operations on numbers while still providing fairly high precision.
There are also wrapper libraries, like rug, that depend on MPFR for implementing arbitrary precision floating point numbers.
This library is written in pure Rust, provides more precision than f32, f64, and some other data types with increased precision.
Number characteristics
Number has fixed-size mantissa and exponent.
Name | Value |
---|---|
Base | 10 |
Decimal positions in mantissa | 40 |
Exponent minimum value | -128 |
Exponent maximum value | 127 |
no_std
Library can be used without the standard Rust library. This can be achieved by turning off std
feature.
Performance
Currently num-bigfloat
does not outperform more older and mature libraries, but work is underway to make it faster. Here you can find comparison with rug
/MPFR
: bigfloat-bench.