Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hubbleprotocol/decimal-wad
https://github.com/hubbleprotocol/decimal-wad
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hubbleprotocol/decimal-wad
- Owner: hubbleprotocol
- Created: 2021-11-30T13:17:08.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-31T08:46:17.000Z (over 1 year ago)
- Last Synced: 2025-01-01T23:38:28.411Z (21 days ago)
- Language: Rust
- Size: 26.4 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Decimal WAD
Math for preserving precision floats which are limited to be at most u64::MAX.- Decimals are internally scaled by a WAD (10^18) to preserve precision up to 18 decimal places.
- Decimals are sized to support both serialization and precise math for the full range of unsigned 64-bit integers.
- The underlying representation of decimals is a u192 rather than u256 to reduce compute cost while losing support for arithmetic operations at the high end of u64 range.
- Rates are sized to support both serialization and precise math for the full range of unsigned 8-bit integers.
- The underlying representation of rates is a u128 rather than u192 to reduce compute cost while losing support for arithmetic operations at the high end of u8 range.