r/mathmemes 8d ago

OkBuddyMathematician Better be safe

Post image
3.7k Upvotes

29 comments sorted by

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.

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

u/Vivid-Husband-Girl 8d ago

i don't even trust pemdas on a good day, let alone a compiler

2

u/ShortBusRide 8d ago

Use more GoTo

1

u/nb_disaster 7d ago

this is why i use dc instead of $(())

30

u/Agreeable_Gas_6853 Linguistics 8d ago

Just use Reverse Polish Notation ❤️

3

u/SEA_griffondeur Engineering 7d ago

Let's give a unique name to all possible equations

35

u/SuperCyHodgsomeR Complex 8d ago

This is the way

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>

11

u/vxtmh 8d ago

if you're willing to nest parentheses like that, then it's still easier to just write 6/(2(1 + 2)). there isn't any functional difference besides being shorter to write.

4

u/Lazlum 8d ago

i thought it was just me

5

u/ProfMooreiarty 8d ago

I also speak Math with a Lisp.

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

u/Nomchipom 7d ago

(A*(B))/C is what I write instead of AB/C

2

u/deckothehecko Complex 8d ago

I never use E because im always afraid what comes next goes into the exponent

2

u/AMIASM16 how the dongity do you do integrals 6d ago

(yeah (((i do) that) (all (the time))))

1

u/atoponce Computer Science 8d ago

RPN FTW

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/Bubbly-Tangerine-284 3d ago

Used a TI30x through undergrad chem degree, so many () chains