-
Notifications
You must be signed in to change notification settings - Fork 273
Description
I've been using TinyExpr in my project and recently needed standard comparison operators (<, <=, >, >=) and boolean logic (!, &&, ||). I've just implemented this in my fork with this commit cschreib@c1b01d8 and this one cschreib@4cdeb91 (adding == and !=).
Booleans are simply 0.0 for false and 1.0 (or any non-zero value) for true.
I've written a test suite to make sure that the precedence with respect to other binary operators is correct, and it all seems to work fine. There is one little thing that I do not understand though, is that I was expecting !!1 to produce 1, since --1 produces 1 in TinyExpr. I do not understand what the difference is, but !!1 currently produces 0 regardless of how many negation operators are used. It's no big deal for me, but it would be good if this worked to be consistent with the other unary operators.
Let me know if you're interested in merging this feature, then I'll prepare a pull request.