Yes.
80917.65 => 32-bit IEE 754 is 0x479e0ad3 == 80917.6484375 1 .00111100000101011010011 80917.65 => 64-bit IEE 754 is 0x40F3C15A66666666 == 80917.650000000000 1 .00111100000101011010011 00110011001100110011001100110 The last part, the “…00110011001100110011001100110,” is not representable in 32-bit floating point and makes the difference that you see. From: <[email protected]> on behalf of Mauro Romano Trajber <[email protected]> Date: Wednesday, December 14, 2016 at 9:35 AM To: "[email protected]" <[email protected]> Subject: [go-nuts] float32 vs float64 precision lost when casting to int 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 from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
