You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Builtin math: ^ operator is left-associative #6280
Hie @ridiculousfish, I am really interested. Issue is really interesting and as I am new here I will need a little help. I have built it and I am looking into tinyexpr.cpp but not sure about changes..
Easy fix. This is configurable in upstream TinyExpr and that author just likes the left-to-right because that's how spreadsheets do it. I think it will confuse people. Let's change it.
See it has a compile time option for TE_POW_FROM_RIGHT? That provides a different version of the factor() function which has a while loop with different logic. Ours needs to be adapted to do the same thing. We've diverged and minimized our code from theirs a bit so there may be some adaptation required, it may be a fun practice to try to apply/translate the same differences you see to our codebase if you like!
Hie @floam, Can you please look into my changes ?
I have removed a bunch of code saying => -a^b = -(a^b) as -2^2 = 4 not -4
Not sure about this tho :)
I have found an issue on upstream codeplea/tinyexpr#52
Hey @floam, Thank you for guiding me out. Btw I have created a PR (may be someone will) please review it whenever possible
Activity
ridiculousfish commentedon Nov 7, 2019
Seems like a fun isolated bug to tackle for anyone interested. Thanks for filing!
ankush-0x90 commentedon Nov 8, 2019
Hie @ridiculousfish, I am really interested. Issue is really interesting and as I am new here I will need a little help. I have built it and I am looking into tinyexpr.cpp but not sure about changes..
floam commentedon Nov 8, 2019
Easy fix. This is configurable in upstream TinyExpr and that author just likes the left-to-right because that's how spreadsheets do it. I think it will confuse people. Let's change it.
floam commentedon Nov 8, 2019
If you want to give it a shot @asprazz, go ahead! Look at this code upstream:
https://github.com/codeplea/tinyexpr/blob/ffb0d41b13e5f8d318db95feb071c220c134fe70/tinyexpr.c#L415
See it has a compile time option for
TE_POW_FROM_RIGHT? That provides a different version of thefactor()function which has a while loop with different logic. Ours needs to be adapted to do the same thing. We've diverged and minimized our code from theirs a bit so there may be some adaptation required, it may be a fun practice to try to apply/translate the same differences you see to our codebase if you like!ankush-0x90 commentedon Nov 9, 2019
@floam Thank you for clarification. I will be working on this now.. :) 💯
ankush-0x90 commentedon Nov 9, 2019
Hie @floam, Can you please look into my changes ?
I have removed a bunch of code saying => -a^b = -(a^b) as -2^2 = 4 not -4
Not sure about this tho :)
I have found an issue on upstream codeplea/tinyexpr#52
Hey @floam, Thank you for guiding me out. Btw I have created a PR (may be someone will) please review it whenever possible
ArashPartow commentedon Mar 19, 2020
This issue was raised with the author a long time ago:
codeplea/tinyexpr#10 (comment)