package main
import (
"fmt"
"reflect"
)
func main() {
a, b := 2, 3
x := 1.0 * a / b
fmt.Println(x)
fmt.Println(reflect.TypeOf(1.0 * 2 / 3))
fmt.Println(1.0 * 2 / 3)
}
Output:
0
float64
0.6666666666666666
How is it that the first output is not equal to the third?
I expected that given that * has precedence over /, the expressions 1.0 * a will be resolved first and will result in a float64 which will then be multiplied by b resulting in a float64 as well.