Closed
Description
What version of Go are you using (go version
)?
$ go version go1.19
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env
What did you do?
package main
import (
"fmt"
)
func main() {
v := int64((float64(0.03) - float64(0.02)) * 1_000_000)
fmt.Println(v)
}
https://go.dev/play/p/V0KH5qKf6u4
What did you expect to see?
10000
What did you see instead?
cannot convert (float64(0.03) - float64(0.02)) * 1_000_000 (constant 10000 of type float64) to type int64