math icon indicating copy to clipboard operation
math copied to clipboard

Add some generic number type when you don't know if the result will be `int` or `decimal`

Open matronator opened this issue 1 month ago • 1 comments

As far as I know, the bc library (and gmp too I think) works on arbitrary precision numbers and doesn't discriminate between int or float/decimal. I am re-writing a TypeScript library to PHP and now need to use some BigNumber's math, but am not sure whether the calculations should be done on Integers or Decimals.

It would be great if there was some generic number type that would automatically convert to BigInt if there's no decimals after the calculation or BigDecimal otherwise.

matronator avatar May 31 '24 01:05 matronator