13 releases
new 0.2.2 | May 1, 2024 |
---|---|
0.2.1 | Apr 10, 2024 |
0.2.0 | Mar 31, 2024 |
0.1.9 | Mar 30, 2024 |
0.1.1 | Dec 30, 2023 |
#2193 in Magic Beans
744 downloads per month
22KB
495 lines
Soroban-Math
A high-precision fixed-point math library for Soroban smart contracts on the Stellar blockchain.
This project aims to empower Soroban developers with precise mathematical operations and advanced functions while minimizing precision loss. It is currently under development and subject to enhancements and optimizations.
Quickstart
Add this to your Cargo.toml:
[dependencies]
soroban-math = "0.2.2"
And this to your code:
use soroban_math::*;
Features
- High-Precision Arithmetic: Perform calculations with numbers using the i128 type, ensuring precision and accuracy.
- Advanced Math Functions: Access advanced mathematical functions like logarithms, exponentiation, and more.
- Ergonomic API: An intuitive API for easy integration into Soroban smart contracts.
- Minimized Rounding Losses: Specialized techniques to reduce rounding errors during calculations.
- Security: Audit-ready code to ensure the safety and correctness of calculations.
Use Cases
Soroban-Math is essential for any Soroban-based project that requires high-precision mathematical calculations, for example:
- DEX protocols
- Stablecoins
- Lending Protocols
Authors
Rahul Soshte (Twitter)
Dependencies
~13MB
~282K SLoC