Expand description
Deterministic fixed-point arithmetic for financial computation.
This crate provides Decimal, a 128-bit decimal type with configurable
rounding modes designed for financial calculations that must produce
identical results across all platforms.
§Oracle Integration
The oracle module provides utilities for working with different oracle
decimal formats (Chainlink, Pyth, etc.) commonly used in DeFi applications.
Modules§
- oracle
- Oracle decimal conversion utilities.
Structs§
- Decimal
- A 128-bit decimal number with deterministic arithmetic.
Enums§
- Arithmetic
Error - Error returned when an arithmetic operation fails.
- Parse
Error - Error returned when parsing a decimal from a string fails.
- Rounding
Mode - Rounding mode for decimal operations.
Functions§
- approx_
eq - Compares two decimals with an absolute tolerance.
- approx_
eq_ relative - Compares two decimals with a relative tolerance.
- approx_
eq_ ulps - Compares two decimals with both absolute and relative tolerances.
- within_
basis_ points - Checks if a value is within a basis point tolerance of another value.
- within_
percentage - Checks if a value is within a percentage of another value.