Re: [go-nuts] Re: int16 and float64 Multiplication

2017-02-18 Thread ngjunyen
After some testing I just decided to instead round the numbers to 2 decimals instead. Thank you for the heads up though. On Sunday, February 19, 2017 at 5:42:15 PM UTC+11, Michael Jones wrote: > > This feels unlikely. > > You might want to verify that the calculation matches your expectations >

[go-nuts] Re: int16 and float64 Multiplication

2017-02-18 Thread ngjunyen
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, ngju...@gmail.com 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 exac

[go-nuts] int16 and float64 Multiplication

2017-02-18 Thread ngjunyen
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)