This feels unlikely. You might want to verify that the calculation matches your expectations exactly at many values. Ian's representation argument applies at every word size it may be that you just hit a "lucky" happenstance.
On Sat, Feb 18, 2017 at 11:59 PM <[email protected]> wrote: > Thank you for your help. I managed to get the result I needed by using 32 > bit floats. > > > On Sunday, February 19, 2017 at 3:36:06 PM UTC+11, [email protected] > wrote: > > I am trying to multiply an int16 and float64 in Golang 1.8 but the result > it returns is incorrect. I need this number to be exact for some hash > verification. Any ideas why this might be happening? > > int16(10) // 10 > float64(int16(10)) // 10 > > float64(3.99) // 3.99 > > float64(int16(10)) * float64(3.99) // 39.900000000000006 > > > > > -- > 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. > -- Michael T. Jones [email protected] -- 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.
