@upendra.manike/precise-math
v1.0.5
Published
Decimal-safe math for JavaScript/TypeScript - accurate arithmetic (add, sub, mul, div, round) without floating-point errors. Plus factorial, prime numbers, fibonacci, GCD, LCM, number conversions, perfect numbers, Armstrong numbers, and more. Perfect for
Maintainers
Keywords
Readme
@upendra.manike/precise-math
Decimal-safe math for JavaScript without floating-point surprises. Accurate add, sub, mul, div, and round.
Install
npm i @upendra.manike/precise-mathUsage
import { add, sub, mul, div, round } from '@upendra.manike/precise-math';
add(0.1, 0.2); // 0.3
sub('1.00', '0.7'); // 0.3
mul(1.5, 3); // 4.5
round(0.105, 2); // 0.11AI Agent Integration
- Deterministic math ideal for AI-generated code
- Minimal API surface, fully typed
API
- add(a, b)
- sub(a, b)
- mul(a, b)
- div(a, b, precision = 12)
- round(value, digits = 0)
License
MIT
