Ratmath is a powerful JavaScript library for exact rational arithmetic and interval arithmetic. Unlike floating-point numbers, Ratmath maintains perfect precision for fractional calculations, making it ideal for financial calculations, scientific computing, and any application where exact results matter.
No rounding errors or precision loss. Every calculation is mathematically exact using rational numbers.
Work with ranges and uncertainties. Perfect for error analysis and approximate calculations.
Support for fractions, decimals, repeating decimals, mixed numbers, and scientific notation.
Built on BigInt for arbitrary precision while maintaining excellent performance.
Explore the Stern-Brocot tree to understand the relationships between rational numbers and continued fractions.
Full support for continued fraction notation, convergents, and optimal rational approximations.
Created by James Taylor with the help of Novix and Zeddy! 🎉