# [Newbies] Does +, -, *, / have more precedence over power?

Andreas Wacknitz A.Wacknitz at gmx.de
Sat Nov 11 22:38:34 UTC 2017

```Am 11.11.17 um 23:12 schrieb RedTigerFish:
> 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 ?
No. Smalltalk has only message sends. And these message sends have a
precedence (from higest to lowest):
Unary messages        (example: 100 factorial)
Binary messages        (example: 2*3)
Keyword messages    (91 raisedTo: 4)

In  "91 raisedTo: 3+1" you have a keyword message (raisedTo:) and a
binary message (+).
The binary message will be evaluated first and then the keyword message.

Regards
Andreas
>
>
>
> -----
> 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
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

```