[Newbies] Does +, -, *, / have more precedence over power?
RedTigerFish
chihuyu at gmail.com
Sat Nov 11 22:12:06 UTC 2017
I understand in Smalltalk numerical calculation, if without round brackets,
everything starts being calculated from left to right. Nothing follows the
rule of multiplication and division having more precedence over addition and
subtraction.
Like the following codes
3 + 3 * 2
The print output is 12 while in mathematics we get 9
But when I started to try power calculation, like
91 raisedTo: 3 + 1.
I thought the answer should be 753572
What I actual get is 68574964
Why's that?
Is it because that +, -, *, / have more precedence over power ?
-----
Dig, dig where you are,
Down below's well.
Let those that walk in darkness shout,
Down below's hell.
--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
More information about the Beginners
mailing list