Expand description
MpFloat / MpComplex adapter types that mirror the rug::Float /
rug::Complex API. Drop-in replacements for rug-using code.
MpFloat — a rug::Float-compatible adapter over dashu-float’s DBig.
This module provides MpFloat and MpComplex as drop-in replacements
for the rug::Float and rug::Complex types used in scirs2-special’s
arbitrary_precision module. The API surface matches what that module
actually calls; it is not a complete re-implementation of the rug API.
§Design
MpFloat wraps dashu-float’s DBig (decimal arbitrary-precision
big-float) and delegates all arithmetic to it. Special functions
(gamma, erf, etc.) delegate to crate::special.
§Precision
rug::Float precision is measured in binary bits. DBig precision
is in decimal digits. The conversion used here is:
decimal_digits = ceil(bits * log10(2)) ≈ bits * 0.30103
plus a 5-digit guard margin, with a minimum of 10 decimal digits.
Structs§
Enums§
- Round
- Rounding modes for arbitrary-precision operations.
Traits§
- MpPow
- Pow implementation for
MpFloat—base.pow(exp).
Functions§
- bits_
to_ decimal_ prec - Convert a bit precision to an approximate decimal digit count.
- catalan_
at_ bits - Build Catalan’s constant at the given bit precision.
- euler_
gamma_ at_ bits - Build a
DBigconstant for the Euler-Mascheroni constant at the given bit precision. Convenience wrapper so PrecisionContext doesn’t need to import special module.