ncalc / ncalc

NCalc is a fast and lightweight expression evaluator library for .NET, designed for flexibility and high performance. It supports a wide range of mathematical and logical operations.
https://ncalc.github.io/ncalc/
MIT License
617 stars 85 forks source link

Please support BigInteger operations #264

Open xcaptain opened 4 months ago

xcaptain commented 4 months ago

For example: 99999999999999999999999999*888888888888888888888888888888888888888

is a simple expression but will throw an Exception when eval it.

Bykiev commented 4 months ago

BigInteger will be supported by Parlot parser in the upcoming release, then we can implement it's support in NCalc

xcaptain commented 4 months ago

Thanks, related to This PR right? I saw BigInteger in tests.

Bykiev commented 4 months ago

Yes. you're right

xcaptain commented 4 months ago

image

I tried the new Parlot version in my local dev env, the BigInteger worked, hope to see a new version soon. Also I think as a math calculator, it's no need to handle overflow, because integer space is infinite, convert to BigInteger is more useful.

Bykiev commented 4 months ago

The integer overflow can be useful in some cases. BigInteger support can be added via ExpressionOptions without any breaking changes.

Bykiev commented 4 months ago

image

I tried the new Parlot version in my local dev env, the BigInteger worked, hope to see a new version soon. Also I think as a math calculator, it's no need to handle overflow, because integer space is infinite, convert to BigInteger is more useful.

We've updated the Parlot version, would you like to contribute on this feature?

xcaptain commented 4 months ago

I tried, but some other tests failed. It's difficult to decide when to parse to long, BigInteger, decimal, double, BigDecimal, need more time to dig into the code.