Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread 'Thomas Zander' via golang-nuts
On 14 December 2016 at 18:35, Mauro Romano Trajber wrote: > The float to int conversion behaves different for 32 and 64 precision. > https://play.golang.org/p/-zkCNSTbNa > > Is this the correct behavior? It's a caveat for working with floating point numbers, in no way specific to Go: ~ > python

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread Michael Jones
is not representable in 32-bit floating point and makes the difference that you see. From: on behalf of Mauro Romano Trajber Date: Wednesday, December 14, 2016 at 9:35 AM To: "golang-nuts@googlegroups.com" Subject: [go-nuts] float32 vs float64 precision lost when casting to int

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread ayan
On Wednesday, December 14, 2016 at 12:56:58 PM UTC-5, Ayan George wrote: > > > In fact, 80917.64 does predictably work with both types. > And I get the same results in C. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from thi

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread Ayan George
On 12/14/2016 12:44 PM, Jan Mercl wrote: > On Wed, Dec 14, 2016 at 6:36 PM Mauro Romano Trajber > wrote: > >> The float to int conversion behaves different for 32 and 64 precision. >> https://play.golang.org/p/-zkCNSTbNa > I may be wrong but I think that 32 bit floatin

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread Jan Mercl
On Wed, Dec 14, 2016 at 6:36 PM Mauro Romano Trajber wrote: > The float to int conversion behaves different for 32 and 64 precision. > https://play.golang.org/p/-zkCNSTbNa Consider https://play.golang.org/p/ZjRbP0LD22 -- -j -- You received this message because you are subscribed to the Goog

[go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread Mauro Romano Trajber
The float to int conversion behaves different for 32 and 64 precision. https://play.golang.org/p/-zkCNSTbNa Is this the correct behavior? I'm using go version go1.7.4 linux/amd64 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe fr