A high-performance, zero-allocation fixed-point decimal library for Go, optimized for financial applications.
udecimal is a fixed-point decimal library for Go designed specifically for financial applications where performance and precision are critical. It provides high-precision arithmetic with up to 19 decimal places while being optimized for speed and minimal memory allocation.
Go developers building financial applications, such as trading systems, banking software, or payment processors, where exact decimal arithmetic, high throughput, and low latency are essential.
Developers choose udecimal for its combination of high performance (5x to 20x faster than alternatives like shopspring/decimal), near-zero memory allocation, and explicit control over rounding, which prevents subtle financial errors common in other libraries.
A high-performance, high precision, zero allocation fixed-point decimal library for financial applications
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks in the README show it's 5x to 20x faster than alternatives like shopspring/decimal, making it ideal for high-frequency trading or payment processing.
Uses a custom 128-bit integer representation to achieve 99% zero allocation, minimizing garbage collection overhead in performance-critical applications.
Forces developers to choose rounding methods like Banker's rounding, preventing subtle financial errors by avoiding implicit rounding as stated in the philosophy section.
All arithmetic operations return new Decimal values, ensuring thread-safe usage across goroutines without race conditions, as highlighted in the features.
Limited to 19 decimal places, which the README admits is not suitable for applications needing arbitrary precision, such as some scientific or high-precision engineering tasks.
Requires manual invocation of rounding methods for every operation that exceeds precision, adding complexity and potential for developer oversight in error-prone financial code.
In rare cases where coefficients exceed 128 bits, it falls back to slower big.Int operations with memory allocation, causing unpredictable performance hits as explained in the 'How it works' section.