4 ms·
The documentation says this adheres to the `math/big` API in some respects - can someone speak to what differentiates this from `math/big`?
by jakewins 9y ago
The documentation says this adheres to the `math/big` API in some respects - can someone speak to what differentiates this from `math/big`?
- friday99 9y agoIt deals with floating-point, arbitrary-precision decimal numbers, whereas math/big contains support for arbitrary-precision integers, rationals and binary floating point. Looking at it briefly, it looks like it uses math/big under the hood when the numbers are large, but uses an internal compact form for efficiency when numbers are small ~<= 20 decimal digits.
- barsonme 9y agoYep! That’s what it does. Hopefully I can get it moved over to BCD which will drop basic arithmetic performance, but more than make up for it when faster rounding. :-)
- tomku 9y agoThe key word is "decimal", this is a library for decimal floating point arithmetic. `math/big` uses binary floating point. The difference is in which floating point numbers can be represented without requiring an infinite expansion. Lot more info at http://speleotrove.com/decimal/ http://speleotrove.com/decimal/.