Expand description
Arbitrary-precision floating-point arithmetic for the OxiNum ecosystem.
Provides wrappers over dashu-float’s FBig/DBig with convenience
functions for elementary math: exp, ln, sqrt, pow, trigonometric
functions (sin, cos, tan, atan, atan2), hyperbolic functions
(sinh, cosh, tanh), and high-precision constants (pi, e, ln2).
Precision-control helpers (precision::with_precision,
precision::epsilon, precision::ulp) wrap the underlying
dashu-float precision primitives in an ergonomic free-function API.
§Why Hash is not implemented
DBig (FBig<HalfAway, 10>) intentionally does not implement
core::hash::Hash. In IEEE 754 (and by extension in essentially
every numeric library that takes the standard seriously) floating
point values defy the Hash contract: distinct representations can
compare equal (e.g. 1.0 and 1.00 at different precisions, or
signed zeros +0 and -0), special values like NaN are not
equal to themselves, and the canonical form needed to make hashing
well-defined varies by use case (totalOrder vs. mathematical
equality vs. bitwise identity). Rust’s standard library follows
the same convention: f32 and f64 deliberately do not implement
Hash. Callers who need a hash key should either use a
canonicalised representation (e.g. a tuple of (significand, exponent, precision)) or wrap DBig in a newtype with an
explicit, documented hashing policy.
§Features
serde(off by default) — enablesserde::Serialize/DeserializeforDBigviadashu-float’s ownserdefeature.
Modules§
- native
- Native binary-base arbitrary-precision floating-point implementation.
- precision
- Precision-control helpers for the
DBigwrapper. - round
- Rounding modes re-exported from
dashu-floatso callers do not need a direct dependency ondashu-floatfor basic rounding-mode selection.
Structs§
- Context
- The context containing runtime information for the floating point number and its operations.
- FBig
- An arbitrary precision floating point number with arbitrary base and rounding mode.
Enums§
- OxiNum
Error - Errors from OxiNum operations.
- Rounding
Mode - Rounding modes for arbitrary-precision arithmetic.
Functions§
- atan
- Compute
atan(x)using dashu-float’s binary conversion and Taylor approach internally. For |x| <= 0.5 we use the series directly; for larger |x| <= 1 we use the half-angle formula; for |x| > 1 we use the identityatan(x) = pi/2 - atan(1/x). - atan2
- Compute
atan2(y, x)with proper quadrant handling. - compute_
e - Compute Euler’s number e to the given number of decimal digits.
- compute_
ln2 - Compute ln(2) to the given number of decimal digits.
- compute_
pi - Compute pi to the given number of decimal digits of precision.
- cos
- Compute
cos(x)using Taylor series with argument reduction. - cosh
- Compute
cosh(x) = (e^x + e^(-x)) / 2. - exp
- Compute
e^xwith the given number of significant decimal digits. - ln
- Compute
ln(x)(natural logarithm) with the given precision. - pow
- Compute
base^expfor arbitrary float exponents. - sin
- Compute
sin(x)using Taylor series with argument reduction. - sinh
- Compute
sinh(x) = (e^x - e^(-x)) / 2. - sqrt
- Compute the square root of
xwith the given precision. - tan
- Compute
tan(x) = sin(x) / cos(x). - tanh
- Compute
tanh(x) = sinh(x) / cosh(x).
Type Aliases§
- BigFloat
- Type alias for decimal big-float.
- DBig
- Multi-precision float number with decimal exponent and HalfAway rounding mode
- OxiNum
Result - Convenience alias for
Result<T, OxiNumError>.