Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Ok, i get it. Because they want calculation to be instantaneous.. they should provide way to opt out of this
-
f03n1x65807yDidn't realize New Zealand was so weird and apperently Canada do this as well, but we call the acronym bedmas where the e stands for exponents
-
CCTrollz7437y@f03n1x in the US its PEMDAS Parentheses, Exponents, multiplication/division, addition/subtraction
-
hbbq7107yIn this case Android is right and Casio is wrong.
http://mathmagical.co.uk/Mathematic... -
@hbbq I think so too. The Casio multiply the result of the parenthese (3) with the 2 first. And then divide the 6 by 6 = 1.
But Android sees after sum up the parentheses 6 ÷ 2 × 3 = 9
9 is right ;) -
I hope someone, expect me, can understand what I mean xD
(My english isn't so good) -
@HoloDreamer Android actually is following bodmas (at least how I have been taught bodmas) :)
-
@hbbq not to me....not at all
I grew up with PEMDAS and the one on the left makes me want to cry. I say the answer is 1. 😋 -
hbbq7107y@twoFour1009 you got to remember that, according to PEMDAS, M and D are of equal value (as is A and S). For adjacent Ms and Ds the "left to right" rule is used.
-
Teosz14147yYou have to add the multiplication symbol before the parentheses to make it work. But I also tend to forget it, maybe that's why I've failed so many exams.
-
Now try this in php...
$a = true and false;
The statement is false, but $a is true because '=' has precedence over 'and'. -
elazar10307ytl;dr: both calculators make sense.
There is no single convention about the precedence of "no operator". Consider the expression 4/2x. If you ask Wolfram, it will parse it as (4/2)*x. If you ask Google, it will parse it as 4/(2*x).
The important thing to note is that it's incorrect to talk about precedence of _operations_ (semantics) since precedence is property of syntax, so we should talk about precedence of _operators_ (syntax). In this case, we have two different operators: * and the "no operator" if you will. The both eventually map to the same function, but this does not mean their precedence must be the same. -
elazar10307yPersonally I read and write 1/2x to mean 1/(2*x), like many other people. But when there is any doubt, we should use conventional notation and use parentheses.
-
elazar10307y@PhantomBKB no, Android is left...
There's no right or wrong when there is no single convention. -
ajfaura137yFirst operations in parenthesis, then multiplications and divisions, and then additions and subtractions. Operations with same priority must be executed in order.
Android is right, Casio is wrong -
elazar10307y@ajfaura do you read 1/2x as (1/2)x? If you do, ask your friends or colleagues. Certainly this is not the only possible reading: there is no single convention in this case.
-
You know what the right solution is? Use parenthesis!
Group terms with parents, and you won't be in this confusion.
6 ÷ (2 * (2+1)) for 1
(6 ÷ 2) * (2+1) for 9
Even still.. 9 is right without parents because M and D are on the same level, thus you go from left to right. -
@bittersweet the important part being that it is correct. You can also make it readable.. spaces, highlighting, using multiple lines.. etc
If people are getting multiple different answers, readability doesn't really matter.. it's obviously not readable. -
@rrmhearts True! Just reminds me of complex sql queries where a select or where starts with (((((((((((, and you have to decipher or parse it from an error log 😁
-
@bittersweet Yeah, it can be challenging. One of my classes in school was taught in scheme.... Brrrrr. Avoid at all costs... Indent continually.
-
J4s0n13357y@elazar in German schools we learn to go from left to right also in Germany / isn't the same as ÷. / is a fracture which would be treaded like 1/(2*x) while ÷ is treaded like (1÷2)*x because it's a division.
-
Root825577yParenthesis > exponents > multiplication > division > addition > subtraction
Why would there be multiple orders? Why should there be room for interpretation? Math isn't subjective.
The same expression should always produce the same result regardless of language, region, culture, planet, etc. To do any different is disastrous. -
elazar10307y@PhantomBKB your proof does not take into account the fact that different syntax can have different precedence, even if it maps to the same operation. Precedence is syntactic, not semantic.
-
@Ashkin But most mathematicians will consider addition and subtraction on one tier, to be interpreted left to right without looking at the symbols. Same for multiplication and division.
-
josh12382037yI've always been taught to interpret 6÷2 (2+1) as 6÷(2×(2+1))... has my life been a lie up to this point?
-
sudoguy5947yI use brackets all the time because of this behavior. Cant go wrong anytime :) . It is maybe unreadable for the first time but you will get used to it.
-
watzon46247yI’m so disappointed 😔 all developers should at least know how to solve this simple problem. Parentheses, exponents, multiplication, division, addition, subtraction. If you don’t believe it check Wikipedia https://en.m.wikipedia.org/wiki/....
The answer is 1. Just 1. Not 9. Never ever will it be 9. The 9 that the phone gave was the result of crappy code.
Gahh, the level of disappointment I’m feeling is astounding -
6÷2X3 is too ambiguous to be meaningful, blindly following BODMAS gives 9, but it also makes sense that if you have written like this you mean that 2X3 is in denominator, solution is "use brackets properly"
Related Rants
-
linuxxx32*client calls in* Me: good morning, how can I help you? Client: my ip is blocked, could you unblock it for m...
-
DRSDavidSoft28Found this in our codebase, apparently one of my co-workers had written this
-
linuxxx23*client calls* "hello, we forgot the password to our WiFi router. Could you reset that for us?" 😐😶😮...
Not sure if DevRant material, but I am hecking bamboozled. What else have I calculated wrong.
undefined
postfix
pemdas
bodmas
wtf