Closed giulio-mae closed 3 years ago
Can confirm the bug, thanks :)
I have a hunch of why this may be happening. I think operations are accidentally executed from right to left, instead of left to right. That would at least explain the result of 0.5. Of course not having proper priority would also explain it (executing * before /), but I am quite sure we did take care of having them on the same level.
Edit: We confirmed 2/2/2
results in 2, instead of 1/8. So it indeed appears to be executing right to left.
Reviewed with Tar. Tar noticed that parseArithmeticPriority4
should be calling parseArithmeticPriority5
. Ultimately this was a typo. Thanks for reporting the issue!
Hi, I recently updated the library to the newest version and I think this bug has reappeared... Set lambda = stdLambda.Create("$1 / $2 / $3") lambda(2, 2, 2) is again evaluated as 2
@giulio-mae Thanks, not sure how this snuck back in again... But fixed again now 👍
Hello, I probably found an issue in how StdLambda parses expressions involving and / operators. Consider the following: Set lambda = stdLambda.Create("$1 $2 / $3 * $4")
If I evaluate lambda(1,2,2,2), the result is 0.5 instead of 2.
Thank you