Arbitrary precision decimal numbers

frame frame86 at live.com
Fri Aug 5 14:00:32 UTC 2022


On Thursday, 4 August 2022 at 13:01:30 UTC, Ruby The Roobster 
wrote:
> Is there any implementation in phobos of something similar to 
> BigInt but for non-integers as well?  If there isn't is there a 
> dub package that does this, and if so, which one?

We have this:

https://code.dlang.org/search?q=decimal

I end up using BigInt instead on a custom wrapper that stores the 
precision hint. To calculate with any number, it need to convert 
each value to the same base (eg. storing 10.234 simply results in 
a BigInt with value 10234 and the precision hint of 3) and then 
forward the operation to BigInt.


More information about the Digitalmars-d-learn mailing list