Releases: bpierre/dnum
2.17.0
2.16.0
2.15.0
2.14.0
2.13.1
This version adds the possibility to specify the rounding method for multiply() and divide(), and also fixes a bug with the divideAndRound() function when the divisor is negative.
More details from @gidonkatten’s PR (see #13):
The default behaviour for the multiply and divide operations was to
ROUND_HALF. Added the possibility to specify whether toROUND_UPorROUND_DOWN. Rounding down is especially important as that is the typical behaviour in smart contract opcodes (EVM and non-EVM alike).Also fixed a bug in the
divideAndRoundfunction (which is called by many operations) when the divisor is negative. E.g.divideAndRound(-15n, 2n)) anddivideAndRound(15n, -2n)yielded different results.
Thanks @gidonkatten 🙏
2.12.0
2.11.0
2.10.0
This version fixes an issue where projects using Node16 or NodeNext moduleResolution in their TypeScript projects were not able to resolve the types.
See #7 for details.
Thanks @ryangoree!
2.9.0
This version adds toString(), which works like toNumber():
let value = [123456789000000000000000n, 18];
toString(value); // "123456.789"
toString(value, 1); // "123456.8"Thanks to @DannyDelott for suggesting this! 🙏
2.8.1
API changes:
format(): now has asignDisplayoption, which allows to control how to display the sign for the number. It follows the same rules as theIntl.NumberFormat()signDisplayoption.
Bug fixes:
- Fixes an issue with the
format()function where the sign was missing from negative numbers with a whole part equal to 0.
Internal changes:
formatSign(): (internal) returns a number sign.toParts(): (internal) the whole part is now always positive. This is to make its behavior consistent: before this change, the sign was only removed when the value of the whole part was 0.
