plugged that into ghci as 5+2*(8-5), and it says 17.
You might want to report that error. Or, did you mean 2+5*(8-5)?
Comment on I dunno
Digit@lemmy.wtf 23 hours ago
Hrmm.
I read that as resulting in 21.
My education system did fail me.
I plugged that into ghci as 5+2*(8-5), and it says 17.
:(
I did (5+2)*(8-5).
Doh.
plugged that into ghci as 5+2*(8-5), and it says 17.
You might want to report that error. Or, did you mean 2+5*(8-5)?
Oops! Typo. School failed me hard!
How far along in school are you btw?
I did (2+5)*(8-5).
The problem is you can’t just add parenthesis willy nilly, that breaks the whole equation!
Well, it used to be a free country until common core and now this nonsense is the result. Numbers and punctuation mixed together. Pure chaos.
A_Chilean_Cyborg@feddit.cl 22 hours ago
You do parenthesis first and then multiplications and then sums, you did parenthesis, then sums, then multiplications, wich is wrong.
merc@sh.itjust.works 13 hours ago
You don’t necessarily have to do parentheses first. What matters is that the things inside the parentheses are a group that you can’t break apart. If you have
10÷2+3-2*(2+1)you can do the division first5+3-2*(2+1)then the addition outside the parentheses8-2*(2+1)It’s just that before you do the multiplication of the term outside the parentheses, you have to handle the parentheses group, so you get8-2*3->8-6->2