1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! A Rust translation of Fabrice Bellard's
//! [libbf](https://bellard.org/libbf/), a tiny arbitrary precision
//! floating point library.
//!
//! The two main value types are [`BigFloat`] (arbitrary precision binary
//! floating point, corresponding to libbf's `bf_t`) and [`BigDecimal`]
//! (arbitrary precision decimal floating point, corresponding to `bfdec_t`).
//! Type-level format wrappers [`Float<F>`] and [`Decimal<F>`] pair a value
//! with a [`StaticFormat`] so that arithmetic operators automatically apply
//! the correct precision and rounding mode.
//!
//! Features include basic arithmetic, fused multiply-add, square root,
//! transcendental functions (exp, log, pow, trig), and parsing/formatting
//! in arbitrary radices (2--36).
//!
//! The crate is `no_std` compatible (requires `alloc`).
//!
//! # Aliasing-safe in-place operations
//!
//! libbf's C API allows aliased pointers — the same `bf_t *` can appear as
//! both the output and one (or both) inputs of an operation. Rust's borrow
//! rules forbid this: `self.mul_assign(&self, …)` would require `&mut self`
//! and `&self` simultaneously. Three dedicated method families fill the gap:
//!
//! | Method | Computes | libbf pattern |
//! |--------|----------|---------------|
//! | [`sqr`](BigFloat::sqr) / [`sqr_assign`](BigFloat::sqr_assign) | `self * self` | `bf_mul(r, a, a, …)` |
//! | [`rsub_assign`](BigFloat::rsub_assign) | `lhs - self` (reverse sub) | `bf_sub(r, a, r, …)` |
//! | [`rdiv_assign`](BigFloat::rdiv_assign) | `dividend / self` (reverse div) | `bf_div(r, a, r, …)` |
//!
//! The "reverse" variants are only needed for the non-commutative operations
//! (subtraction, division), where `r == b` produces a different result from
//! `r == a`. Addition and multiplication are commutative, so their existing
//! `_assign` methods already cover the `r == b` case.
extern crate alloc;
/// Arbitrary-precision decimal floating-point arithmetic.
/// Arbitrary-precision binary floating-point arithmetic.
/// Floating-point format descriptors (precision, rounding, exponent range).
/// String-to-number parsing utilities.
/// Arithmetic status flags (inexact, overflow, etc.).
pub use ;
pub use ;
pub use ;
pub use Status;