I would read it that way, yes. Note that regardless of the spec you can
always indicate the intended precedence using parenthesis. If in doubt, I'd
recommend to do that - if you are in doubt, the reader of the code will be
as well.

On Sun, May 30, 2021 at 12:54 AM Scott Pakin <scott...@pakin.org> wrote:

> When the Operator precedence
> <https://golang.org/ref/spec#Operator_precedence> section of the language
> specification says that "Binary operators of the same precedence associate
> from left to right. For instance, x / y * z is the same as (x / y) * z",
> does this imply that the language guarantees that a*3.0/2.0 will always
> be evaluated as (a*3.0)/2.0 and never as a*(3.0/2.0), even though the
> constant expression can be computed at compile time?  Does this hold for
> integer types, too (e.g., a*3/2)?
>
> Thanks,
> — Scott
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/4f64105d-7ecb-4cf8-a18f-d045ace5e9ecn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/4f64105d-7ecb-4cf8-a18f-d045ace5e9ecn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfFbPBhifhw5WaqX8C976ZTA_rxNhBK6Q%2BabZKr7LDU75w%40mail.gmail.com.

Reply via email to