Open alxiong opened 3 years ago
I think a big number library would make sense, but we would like to see a variety of use cases that would benefit from it.
The motivation given here in the issue has some problems, because it assumes stabilityFee
is a decimal number, and that is also something that we don't currently have a library for.
In case this is still relevant, I posted such utility a few months ago:
🧐 Motivation This issue is brought to my attention by a question from @wly99.
Say I want to calculate the future value of principal on a 30-year home loan:
since
stabilityFee
is a floating number, (e.g.0.00225
) so we need to multiply it by10000
in practice; but then with the power ofmonthsLeft = 12 * 30 = 360
, this value could easily exceedtype(uint256).max
.We want arbitrary precision arithmetic for BigInt.
📝 Details
There is one sample
library BigInt {}
in Solidity's doc here:But still, would love the excellent engineers and security experts from OpenZeppelin community to take a more careful vetting and standardize it by including in future version of the library.