I got some rounding problems with NCalc. My problem is quite simple. just add 0.5 and 0.5555. expected result is 1.0555. This i need to round to 3 fractions. 1.056
float and double should not cause me any precision problems at a 5 digit number. However NCalc does.
Expression ex = new Expression("0.5 + 0.5555");
object result = ex.Evaluate();
result 1.0554999999999999 object {double}
This will round down instead of up. Even if the error is 0.0000000~~~~1. Anyone have any ideas how I can solve this ?
Not the very best solution.. but a solution.
will give me the "correct" number back. And by rounding it to 3 fractions it will yield the correct result.