dashu-float-0.6.0-rc.4 has been yanked.
dashu-float
Arbitrary precision floating point number implementation, as a part of the dashu library for arbitrary-precision mathematics. See Docs.rs for the full documentation.
Features
- Supports
no_stdand written in pure Rust. - Support arbitrary base and arbitrary rounding mode.
- Support efficient base conversion.
- Small float numbers are inlined on stack.
- Efficient float number parsing and printing with base 2~36.
- Supports the hexadecimal float format used by C++.
- Developer friendly debug printing for float numbers.
Quick example
Binary and decimal float literals, correctly-rounded transcendentals, and the
Context layer for explicit precision control:
use ;
use ;
// Binary and decimal float literals — hex floats, precision from digit count
let x = fbig!; // ≈ 0.9998
let pi = dbig!;
// Correctly-rounded transcendentals (Ziv engine)
let e = x.exp; // exp(0.9998…), binary
let _log_pi = pi.ln;
// Context layer: IEEE 754 binary64 precision, HalfEven rounding
let ctx = new;
let e53 = ctx.exp.unwrap.value;
assert!; // higher precision, larger value
// set the precision explicitly
let x50 = x.with_precision.value;
assert_eq!;
Optional dependencies
std(default): enablestdsupport for dependencies.
Performance
Relevant benchmark will be implemented in the built-in benchmark.
License
See the top-level readme.