Skip to main content

Crate precision_core

Crate precision_core 

Source
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§

ArithmeticError
Error returned when an arithmetic operation fails.
ParseError
Error returned when parsing a decimal from a string fails.
RoundingMode
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.