Back to Blog
Just Curious

Engineering Notes

Building a money library is six design decisions, and 'don't use floats' is only the first. A walk through each one (fixed-point representation, the shortest-decimal parse boundary, rounding as configurable policy, conservation as a primitive, value-versus-object API, and verification via oracle plus invariants) using abakojs as the worked example, with the costs named and the alternatives (decimal.js, dinero, currency.js) placed in context.

1 articles
~15 min total
JavaScriptMoneyFloating PointRoundingTypeScript

Articles in this Series

Floating PointJavaScriptMoneyRoundingTypeScript
1
Just Curious
Money Math Is Broken by Default
Building a money library is six design decisions, and 'don't use floats' is only the first. A walk through each one (fixed-point representation, the shortest-decimal parse boundary, rounding as configurable policy, conservation as a primitive, value-versus-object API, and verification via oracle plus invariants) using abakojs as the worked example, with the costs named and the alternatives (decimal.js, dinero, currency.js) placed in context.
Jul 21, 202615 min read
JavaScriptMoneyFloating PointRounding+1