843
Confusing... (lemmy.ml)
submitted 1 year ago by kaptaan_jack@lemmy.ml to c/memes@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] 0x4E4F@lemmy.fmhy.ml 3 points 1 year ago* (last edited 1 year ago)

always use parentheses to denote order, there are no implied parentheses

I completely agree on this, and yes, this is what I always do, cuz... well, we're human, we make mistakes, parentheses makes things easily visible, thus cutting down on mistakes.

Still, I do know operation order, as a rule I mean. In simple calcs like these, making a mistake is almost impossible. Thus, people that answered 16 probably just don't know the order... that is something you learn in 1st, 2nd grade, it's not quantum mechanics we're talking about here.

lazy mfs from centuries ago who were mortified by the thought of having to write ( and ) too much (lord what i wouldn’t give to hop in a time machine and show them lisp) should not be dictating our mathematical notation in this century.

We only do that cuz we're not sure how the compiler will interpret the operation order, and there's waaaay too many versions and different languages to actually remember how each of them interprets math operation order. So, we do a safe bet, put parentheses on everything. Hell, I do it as well, I just can't be bothered to remember if C interprets it like this, Python like that, Rust like... god knows what. They should, in theory, know math operation order, but let's face it, we all do it cuz we've been faced with bugs that are a direct result of the compiler not intepreting things as it should.

That being said, yes, I do agree that prentheses on everything, even math on paper, is the way to go. Plus, even people that don't know operation order, will learn it a lot qucker if you just show them how easy things become once you start using prentheses.

this post was submitted on 19 Jul 2023
843 points (95.7% liked)

Memes

45727 readers
827 users here now

Rules:

  1. Be civil and nice.
  2. Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.

founded 5 years ago
MODERATORS