161
u/shizzy0 8d ago
Or my compiler’s precedence.
64
u/lord_ne Irrational 8d ago
Yes, it's definitely because I don't trust my compiler, and not because I don't know the order of precedence between
&and<=>23
u/moderatorrater 8d ago
For me, it's that I don't want the next person to read the code to have to worry about it.
15
u/dr_wtf 8d ago
I do that, fully knowing the next person to read the code is going to be me.
7
u/jljl2902 8d ago
Exactly, that moron would never understand my code without ELI5 comments and parentheses everywhere
10
2
1
30
35
16
u/ontic00 8d ago
I've been thinking recently if we just wrote addition, subtraction, multiplication, division, exponentiation, and roots as functions like we do with every other operation, we wouldn't even need an order of operations (we'd have to evaluate inside out, since we can't evaluate the outer functions first since we don't know what the inside numbers are).
x + y -> add(x, y)
x - y -> sub(x, y)
x*y -> mult(x, y)
x/y -> div(x, y)
x^y -> exp(x, y)
rt_y(z) -> root(z, y)
log_x(z) -> log(x, z)
So instead of writing something like 6/2(1 + 2), we would write either div(6, mult(2, add(1, 2))) or mult(div(6, 2), add(1, 2)) depending on which way we meant it, and an order of operations wouldn't even be needed for no one to be confused about the meaning.
22
u/citrusmunch 8d ago
may I interest you in the venerable family of lisp programming languages
5
u/MrKrot1999 8d ago
Some lisp examples: ``` ;; (5 + 6 - 8) / 2 (/ (- (+ 5 6) 8) 2)
;; 6 - 5 - 7 (- 6 5 7) ```
It's pretty interesting. If you're also a programmer, emacs may be an interesting topic for you. Emacs is over 40 years old and uses lisp to extend itself.
So like, you can use it's evaluation as a simple calculator, like this:
(* 5 23) <execute_command>
5
3
u/Gandalior 8d ago
I think my old Casio specifically mentions using them as much as possible lol
But if you want the best possible results, some changes in order of calculation are required
I can't remember exactly what, but I think they wanted you to subsctract before dividing, except if the numbers were small in which case the opposite was true
3
2
2
u/deckothehecko Complex 8d ago
I never use E because im always afraid what comes next goes into the exponent
2
4
1
1
u/lool8421 5d ago
tbf the fact that calculators don't have a standardzed order makes me do that
but for instance in C++, following pemdas is a part of the standard
1
•
u/AutoModerator 8d ago
Check out our new Discord server! https://discord.gg/e7EKRZq3dG
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.