[Solved] Operator ‘+’ can’t be applied to operands of types ‘decimal’ and ‘double’ – NCalc [closed]

Ok. I looked at the source code. And here is what I found. The Abs(-1) part of the expression is always evaluated as a decimal Result = Math.Abs(Convert.ToDecimal( Evaluate(function.Expressions[0])) ); Cos(2) is evaluated as double Result = Math.Cos(Convert.ToDouble(Evaluate(function.Expressions[0]))); And C# does not allow you to add these two types together. The reason that Math.Abs(-1) + … Read more

[Solved] Since when does 3 / 5 = 0?

The / operator looks at its operands and when it discovers that they are two integers it returns an integer. If you want to get back a double value then you need to cast one of the two integers to a double double difference = (endX – startX + 1) / (double)ordinates; You can find … Read more