On Friday, 5 August 2022 at 14:00:32 UTC, frame wrote:
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.

I'm already trying to make one, and I have a similar idea, but I ewant it extended to complex numbers.

Also, what about division and exponentiation. You can't just forward them to BigInt and get a good result, BigInt will just round to an integer for these two.

Reply via email to