sklose / NCalc2

expression evaluator for .NET with built-in compiler
MIT License
166 stars 58 forks source link

Fix a bug when mixing floating point with integer #32

Closed bradtglass closed 5 years ago

bradtglass commented 5 years ago

Add a check that ensures that the Min/Max functions run in the highest precision of the 2 parameters. Originally only the type of the first parameter was checked. Fixes a bug that would cause Min(2,1.97) to return 2 because 1.97 was converted to an int during expression evaluation or Max(2,2.33) to return 2 instead of 2.33.

Also added a test in Fixtures.cs to test for both of the above cases going forward.