On 12/14/2016 12:44 PM, Jan Mercl wrote: > On Wed, Dec 14, 2016 at 6:36 PM Mauro Romano Trajber <traj...@gmail.com > <mailto:traj...@gmail.com>> 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 floating point types allow up to 23bits in the mantissa. 8091765 requires 24 bits to encode so with float32, you're dropping the last bit (1 of course) after you multiply by 100.0 and that throws the rounding off. In fact, 80917.64 does predictably work with both types. -- 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.