I am using MathParser.org-mxparser 6.1.0, and with the below expressions I am getting strange results:
| formula |
results |
| [NaN] == 1 |
NaN |
| [NaN] == 1 && 0 == 0 |
NaN |
| [NaN] == 1 && 1 == 0 |
0 |
| if([NaN] == 1 && 0 == 0, 1, 2) |
NaN |
| if([NaN] == 1 && 1 == 0, 1, 2) |
2 |
I have checked a few programming languages handling of NaN and the equality operator returns false (for C# and Java).
So I was expecting [NaN] == 1 to return 0 above instead of NaN.
What is the logic behind this result?
Also why is the 3rd expression returning 0, compared to the 2nd which is returning NaN?
I am using
MathParser.org-mxparser 6.1.0, and with the below expressions I am getting strange results:I have checked a few programming languages handling of
NaNand the equality operator returns false (for C# and Java).So I was expecting
[NaN] == 1to return 0 above instead ofNaN.What is the logic behind this result?
Also why is the 3rd expression returning 0, compared to the 2nd which is returning
NaN?