12 ms·
You've got to go even earlier... which is where the bc link becomes interesting. It's from 1975. Lotus 1 2 3 dates from 1983... I can't find a copy of it tha
by shagie 2y ago
You've got to go even earlier... which is where the bc link becomes interesting. It's from 1975.
Lotus 1 2 3 dates from 1983... I can't find a copy of it that is runnable.
VisiCalc would be a good one to look at at 1979. It also presents 9 https://archive.org/details/VisiCalc_1979_SoftwareArts https://archive.org/details/VisiCalc_1979_SoftwareArts
You've also got sc https://en.wikipedia.org/wiki/Sc_(spreadsheet_calculator) https://en.wikipedia.org/wiki/Sc_(spreadsheet_calculator) from 1981.
docker run -it ubuntu:latest
# apt-get update
# apt-get install sc
# sc
= -3^2
And you'll see 9.00 (screen shots of those two https://imgur.com/a/L0ZvJlP https://imgur.com/a/L0ZvJlP and the one from VisiCalc )
This is the way its worked for a long time.
---
(edit / further thoughts)
I believe that the underlying issue is that unary - (negation) and binary - (subtraction) use the same operator and you need the unary one to have a very high precedence to avoid other problems from happening.
Consider the expression: 2^-2
Is that 0.25 or a parse error?
- bonzini 2y agoUnary and binary - can be given different precedence, because there is never ambiguity as to whether you're in front of a unary minus or a binary minus. A binary operator is never encountered at the beginning, or after a parenthesis, or after another binary operator, therefore those are the cases where you'd have a unary - or +. Rather, the problem is whether -2 is parsed as a numeric literal, or a unary minus followed by a numeric literal (which would only include positive numbers).
- atq2119 2y agoWhy would the expression 2^-2 pose a problem? There is no ambiguity there that requires operator precedence to resolve.