[go-nuts] Re: Why is there a difference between floating-point multiplication with literals vs. variables in Go?

2017-11-09 Thread eriksrocks
Thanks for the answers. I wasn't interested as much in fixed decimal solutions as understanding why what appeared to be the same floating-point math on the surface was returning different results. I also posted this question on Stack Overflow and I think the answers there are pretty comprehensi

[go-nuts] Why is there a difference between floating-point multiplication with literals vs. variables in Go?

2017-11-09 Thread eriksrocks
Why are the following unequal in Go? Is this a bug, or is it by design? If it's by design, why does this occur and is this type of behavior documented anywhere? https://play.golang.org/p/itEV9zwV2a package main import ( "fmt" ) func main() { x := 10.1 fmt.Println("x == 10.1: