4 ms·
"1+1 sq ft in sq in=" The order of operations here is quite ambiguous. It’s not obvious even to a human reader how you would expect this to be interpreted.
by jb1991 1y ago
"1+1 sq ft in sq in="
The order of operations here is quite ambiguous. It’s not obvious even to a human reader how you would expect this to be interpreted.
- mulmen 1y agoI honestly can't tell what this would mean other than 2 square feet in inches. What's the other option?
- fluidcruft 1y agoAnother option could be that it's ill-posed and should just return an error.
- fzzzy 1y ago(1 sq ft in sq in) + 1?
- vrighter 1y agoWhich sort of unit is a "sq ft in sq in" and why would they have coded it in the parser as one? It's only ambiguous if it's explicitly coded badly to induce ambiguity.
- rgovostes 1y agoThere is a perfectly cromulent grammar for a unit-aware calculator: <expression without units> [<unit> [in <unit>]] <expression with units> [in <unit>] "1+2 feet in meters" and "1 foot + 1 meter" are both unambiguous. There is no order of operations in terms of how the units bind. The expression "1 foot + 1" is appropriately invalid. Of course the appropriate care must be paid to interpreting "in" correctly as either a unit or a keyword.