20190803, 09:47  #1 
Dec 2012
The Netherlands
3·587 Posts 
Expression evaluation
We all know that different processors may give different answers when evaluating 3 mod 2.
But it was news to me that calculators differ in their evaluation of 8รท2(2+2): https://www.nytimes.com/2019/08/02/s...asbedmas.html They avoid trying to explain to a general audience that \(2^{2^3}=256\)... 
20190803, 12:18  #2 
Jun 2003
1491_{16} Posts 
8รท2(2+2) is an inconsistent notation, mixing explicit division operator and implicit multiplication operator, so naturally there can be differences in the interpretation.

20190803, 13:56  #3 
Bamboozled!
"๐บ๐๐ท๐ท๐ญ"
May 2003
Down not across
31·359 Posts 

20190803, 14:18  #4 
"Rashid Naimi"
Oct 2015
Remote to Here/There
2197_{10} Posts 
Takes away the ambiguity by giving precedence to division over multiplication, which are actually meant to have equal precedence which by original (before democratically acronym based convention) convention should be evaluated lefttoright, whichever comes 1st.

20190803, 14:35  #5 
"Rashid Naimi"
Oct 2015
Remote to Here/There
2197_{10} Posts 
I think it is ok for the masses to democratically decide who the experts are, but not to democratically decide what the expertopinion is and leave that part to the experts in the field. Otherwise we get Wikipedia.
Last fiddled with by a1call on 20190803 at 14:36 
20190803, 20:27  #6 
"Rashid Naimi"
Oct 2015
Remote to Here/There
13^{3} Posts 
My hat off to you sir. It took me a good 2 hours to comprehend what you said.
Last fiddled with by a1call on 20190803 at 20:28 
20190803, 23:52  #7  
∂^{2}ω=0
Sep 2002
Repรบblica de California
2DA7_{16} Posts 
Quote:
I tested both the expression in the OP and 2^3^4 using Posix bc, it conforms to the PEMDAS, including the above rule for exponentiation. In related flamebait news, is it good or bad that C gives << and >> different priority than * and /? 

20190804, 03:02  #8 
"Kebbaj Reda"
May 2018
Casablanca, Morocco
2×47 Posts 
Reading direction
Reading direction 8รท 2(2+2).
https://www.mersenneforum.org/showth...038#post523038 Last fiddled with by Kebbaj on 20190804 at 03:07 
20190804, 07:24  #9  
Dec 2012
The Netherlands
3×587 Posts 
Quote:
In my experience, code involving shifts also uses other bitwise operators so you end up needing brackets anyway, e.g. Code:
t=(p<<5p>>27)+(q&r^~q&s)+t+0x5a827999+tedoen[0];q=q<<30q>>2; 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Rationality of an expression  jnml  Miscellaneous Math  7  20180906 15:57 
A Fib expression with multiplication  MattcAnderson  Homework Help  5  20161101 08:16 
Theoretical Evaluation of a GPU  tapion64  PrimeNet  10  20140409 22:21 
regular expression help  ixfd64  Programming  2  20090301 06:19 
Does Anyone Know how to Simplify the Following Expression?  jinydu  Puzzles  9  20040402 01:03 