# Crate mpmfnum

Expand description

Number formats, precisions, and rounding modes.

`mpmfnum` is a numbers library for emulation various number formats, at multiple precisions with many rounding modes. Hence its name “Multi-Precision, Multi-Format” (MPMF). Unlike other number libraries like BigInt or Rug (MPFR), this library emphasizes a clean abstraction of various computer number systems rather than high-performance computation.

This library embraces design principles found in the FPCore standard. Most importantly, numerical programs need only be specified by (i) real-number mathematical operations and (ii) rounding. Number formats, e.g., `double` or `float`, are not first-class, as in most programming languages. Rather, formats are side effects of rounding and should be de-emphasized or eliminated entirely. Furthermore, all values within a numerical program should be viewed as (extended) real numbers.

These design principles are reflected in the two primary traits of this library:

For implementation purposes, we restrict any `Real` value to be of the form `(-1)^s * c * 2^exp` where `s` is 0 or 1, `c` is a non-negative integer, and `exp` is an integer. Implementations of `RoundingContext` may support any of the numerous operations (as traits) found under `crate::ops`. Operations provided by this library are correctly rounded.

`mpmfnum` supports various number systems through implementations of `RoundingContext`:

Planned support for posits and more!

## Modules

• Multiple flavors of fixed-point numbers.
• Fixed-precision, floating-pont numbers with unbounded exponent.
• Floating-point numbers as described in the IEEE 754-2019 standard.
• Round-to-odd arithmetic.
• Rounded mathematical operations.
• Exact arithmetic.
• Floating-point numbers with unbounded significand and exponent.

## Traits

• Universal trait for extended real numbers.
• Universal trait for rounding contexts.