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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! The [`Decimal`] trait — width-generic marker that requires the
//! full surface (arithmetic + conversion + transcendentals + constants).
//!
//! `Decimal` itself has no methods; the surface lives on four
//! narrower traits and `Decimal` is a supertrait union:
//!
//! - [`DecimalArithmetic`] — operators, sign, integer-style division,
//! pow / checked / wrapping / saturating / overflowing, plus the
//! foundational type info (`Storage`, `SCALE`, `MAX_SCALE`, `ZERO`,
//! `ONE`, `MAX`, `MIN`, `multiplier()`) and reductions (`sum`,
//! `product`).
//! - [`DecimalConvert`] — `from_bits` / `to_bits` / `scale`, the
//! integer bridges (`from_i32`, `to_int`, `to_int_with`), and the
//! `std`-gated f64 / f32 bridge (`from_f64`, `from_f64_with`,
//! `to_f64`, `to_f32`).
//! - [`DecimalTranscendental`] — the four-variant matrix on every
//! transcendental + roots (`_strict` / `_strict_with(mode)` /
//! `_approx(g)` / `_approx_with(g, mode)`).
//! - [`DecimalConstants`] — `pi` / `tau` / `half_pi` / `quarter_pi` /
//! `golden` / `e` plus their `_with(mode)` siblings.
//!
//! Implemented automatically by a blanket impl, so any type that
//! impls all four halves is `Decimal` for free. Every shipped width
//! (`D9`, `D18`, `D38`, `D56`, `D76`, `D114`, `D153`, `D230`, `D307`,
//! `D461`, `D615`, `D923`, `D1231`) already satisfies the bound via
//! the per-tier macros (`decl_decimal_basics!` for arithmetic +
//! convert, `decl_decimal_consts!` for constants,
//! `decl_decimal_transcendental_impl!` for the transcendental
//! surface).
//!
//! # Usage
//!
//! ```ignore
//! use decimal_scaled::Decimal;
//!
//! // Pulls in the full surface — arithmetic, conversion,
//! // transcendentals, and constants.
//! fn radius_to_area<T: Decimal>(r: T) -> T {
//! T::pi() * r * r
//! }
//! ```
//!
//! When you only need a slice of the surface, target the narrower
//! trait directly to keep bounds tight:
//!
//! ```ignore
//! use decimal_scaled::DecimalArithmetic;
//!
//! fn dot<T: DecimalArithmetic + Copy>(a: &[T], b: &[T]) -> T {
//! a.iter().zip(b).map(|(x, y)| (*x) * (*y))
//! .fold(T::ZERO, |acc, p| acc + p)
//! }
//! ```
//!
//! # Out of scope on `Decimal` (and all four sub-traits)
//!
//! - **Rescale** (`rescale<TARGET>` / `rescale_with`) takes a
//! `const`-generic target `SCALE` parameter; const-generic trait
//! methods aren't stable. Use the inherent method on the concrete
//! type.
//! - **`from_int`** takes a different source integer per width;
//! [`DecimalConvert::from_i32`] is the width-generic constructor.
//! - **Joint kernels** (`sin_cos`, `sinh_cosh`) exist only on the
//! wide tiers; reach for them on the concrete type.
pub use crateDecimalArithmetic;
pub use crateDecimalConvert;
/// Marker supertrait combining the four halves of the decimal API
/// surface ([`DecimalArithmetic`], [`DecimalConvert`],
/// [`crate::DecimalTranscendental`], [`crate::DecimalConstants`]).
///
/// Implemented automatically for any type that implements all four;
/// see the module-level documentation for usage.