-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange behavior with exponents and decimal powers #341
Comments
Oh, good catch!
In my opinion, it should clearly be parsed as |
decimal.js doesn't support decimal exponents though (I just tested). |
Ah okay. Should we parse it as I'm also completely fine with disallowing it entirely. |
Unless somebody specifically asks for it, let's just disallow it. |
Only integer exponents seems fine, but I think implicit multiplication between constants and variables w/o a delimiter is confusing imo. Perhaps you disagree, but I think a space should always be required, or at most with one constant followed by one variable. For example, all of the following parse but I'd argue they should be disallowed due to the potential for confusion.
|
I don't agree that a space should always be required. For instance, I would definitely hate to have to type
I'm not sure what that means exactly, could you elaborate? |
hah fair, but given that no one should ever use anything like that except by mistake, wouldn't that be all the more reason to disallow it explicitly? As you said, however, I do see the value in something like It would also eliminate any confusion with the original issue above, cause |
Fair enough.
That makes sense to me, it's a solution worth exploring. We need to make sure though that the parse error messages are clear (not like the vague "Expected end of input" shown in the issue). |
This is now all properly handled in Numbat, e.g.: https://numbat.dev/?q=2e1.5 (parse error) |
Here's a demonstration:
(Run on current
master
)I believe
2e1.5
here gets parsed as2e1 .5
, equivalent to2e1 * 0.5
. On 5.7.0 however, an error is printed (albeit a somewhat unclear one):This is most likely a result of my PR #296.
Thoughts on the best solution here?
The text was updated successfully, but these errors were encountered: