On Wed, Feb 13, 2019 at 11:23 AM Nigel Tao <nigel...@golang.org> wrote: > Yes, both the Go code and the C code will panic if y is zero. Still, > "-2147483648 % -1" has a sensible mathematical definition (zero), and > C fails to calculate it.
I forgot to mention that, even with a mod-by-zero, Go lets you recover the panic, instead of just letting the hardware issue a raw SIGFPE. Explicitly checking y==0 (in Go's generated machine code) requires some up-front computation, compared to the C code. https://godbolt.org/z/3EPkq1 might be instructive (haha). -- 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. For more options, visit https://groups.google.com/d/optout.