Re: [go-nuts] Operator precedence

2021-06-06 Thread Scott Pakin
Axel and Keith: Thanks for responding. I'm glad it sounds like I'm reading the spec correctly—and that Go shouldn't do anything sneaky with evaluation order. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and st

Re: [go-nuts] Operator precedence

2021-06-06 Thread Scott Pakin
Alex and Keith: Thanks for responding. I'm glad it sounds like I'm reading the spec correctly—and that Go shouldn't do anything sneaky with evaluation order. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and st

Re: [go-nuts] Operator precedence

2021-05-29 Thread 'Keith Randall' via golang-nuts
Yes, Go will evaluate as specified in the spec. So it can't do (a*3.0)/2.0 as a*(3.0/2.0). At least, it always needs to produce results *as if* the former was used. Normally for floats that means it does the ops exactly in the order specified. For integers there are often rewrites that will make

Re: [go-nuts] Operator precedence

2021-05-29 Thread 'Axel Wagner' via golang-nuts
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 wrote: > When the O

[go-nuts] Operator precedence

2021-05-29 Thread Scott Pakin
When the 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