there is always a precision problem when some specific decimals are used in calculation. I don"t know how the go language deals with this problem.
what I don"t understand is why the first two variables, acenture b, are of the same type, so why the subtraction still causes the precision problem
package main
import "fmt"
func main() {
a := 143.66
b := 14.55
c := a - b
// c = c * 100
fmt.Println(c)
fmt.Printf("s = %T\n", a)
fmt.Printf("s = %T\n", b)
fmt.Printf("s = %T\n", c)
d := 1129.6
fmt.Println((d * 100))
}
the printed value is as follows:
129.10999999999999
s = float64
s = float64
s = float64
112959.99999999999