Closed AlexByte closed 7 years ago
Integers are evaluated as 32 bit in NCalc. You might be able to get the correct result by using decimals instead ("2747474.0 * 63663.0") ... see the original NCalc's documentation: https://ncalc.codeplex.com/wikipage?title=values&referringTitle=Home
I believe that the computation should be performed in the checked
statement to be able to catch exception.
It would be convenient to have the option to always use decimal.
Since this is a breaking change it should probably be a setting on the EvaluationOptions. Unfortunately I won't have time to work on this, but I happily accept pull requests if you want to jump in.
I put in an option to enable checked math at least. Always use decimal seems a bit to weird. Also decimal can overflow as well, but will always throw an exception, even in unchecked, this just pushes the error further and not actually fixes it.
It prints
-1 181 221 874
, when the right answer is174 912 437 262
.