Epsilon: Inconsistent expression parsing

Created on 19 Apr 2018  路  3Comments  路  Source: numworks/epsilon

On fraction, result depend on times sign (like casio) :

  • 88/2(1+2) ) = 14.66
  • 88/2*(1+2) = 132

the input / mathprint is correct.

But I found this quite inconsistence.

Most helpful comment

I am in favor of making a/bc equal to (a/b)c.

All 3 comments

Hi @homeostasie ! That's a good catch: the way both expressions are parsed is indeed correct but inconsistent.

First of all, I'd like to say that this is not such a big deal though because the mathematical grammar itself is by design ambiguous: 88/2*(1+2) can be understood both as (88/2)*(1+2) or as 88/(2*(1+2)).

I understand your point though: it would be better if both the implicit and explicit multiplications were parsed the same way. To solve this, one would need to make the Bison grammar used in Poincar茅 (our math engine) unambiguous.

I am in favor of making a/bc equal to (a/b)c.

On fraction, result depend on times sign (_like casio_) :

* 88/2(1+2) ) = 14.66

* 88/2*(1+2) = 132

the input / mathprint is correct.

But I found this quite inconsistence.

Note that the question holds in the _linear writing format_ only and there is no point in the _natural writing format_.

We have settled on the following:

  • the division and multiplication operators have the same precedence and the operations are performed from left to right
  • the implicit multiplication has higher precedence.

The examples you provided follow exactly those rules. From this perspective, there is no inconsistency.

If you think that different rules should apply, please feel free to reopen the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loretoparisi picture loretoparisi  路  3Comments

INailedIt picture INailedIt  路  4Comments

abaveja313 picture abaveja313  路  4Comments

titimoby picture titimoby  路  5Comments

tjhorner picture tjhorner  路  5Comments