muparserx icon indicating copy to clipboard operation
muparserx copied to clipboard

type checking

Open lhommev opened this issue 2 years ago • 1 comments

Hi, I'm using this library and I am very pleased with the capabilities and performance. With vey large data to process, i see ~400K evaluations per seconds with 12 cores CPUs.

Anyway, i noticed that there is no exception thrown when doing this:

123 == "abc"

I would expect an error with this expression. Does this make sense to you ?

lhommev avatar Jun 06 '23 14:06 lhommev

This is a bug. It should be false based on the type alone. I'm not even sure whats happening here that the result is true.

On closer inspection i think it is correct to just return false. At first i was under the assumption the return value is "true". In my mind throwing an exception should only be done if the expression is incorrect. In this case i would go with what JavaScript does.

beltoforion avatar Jun 06 '23 19:06 beltoforion