Re: [go-nuts] int16 and float64 Multiplication

2017-02-18 Thread Ian Lance Taylor
On Sat, Feb 18, 2017 at 7:52 PM, 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 > > flo

[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)