Here is a minor musing from something that came up yesterday.

Sometimes we see a real number expression as simple as...

  x*y/z

...and knowing from basic algebra that...

(x*y)/z == x*(y/z)

...we might not expect much difference between the two in our code. Alas,
computer floating point does not involve real numbers, rather it uses an
approximation of them. If you will copy https://play.golang.org/p/IlDxtvx7IY
to your computer, build and run it, (too much CPU for the playground)
you'll find that the order makes a difference. Or, you can just remember
this phrase, "multiply first, then divide."

-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
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.

Reply via email to