float32 the precision is 7 guaranteed digits. float64 the precision is 15 guaranteed digits.

example:

fmt.Printf("%.f", float32(123_456_789))
123456792 // 7 digits of percision

One of the most common mistakes programmers make when using floating-point numbers is using the == operator as a comparator. Because a floating-point number isn’t properly represented.

The safe way of comparing floating-point numbers is to take into account the precision: if two floating-point numbers are within the precision range of the largest, they should be considered equal; otherwise, they should be considered different

Simply, only trust the percision points.

Go
// 7 decimal places
a := 0.1 + 0.2
b := 0.3
fmt.Println(math.Abs(a-b) < 0.0000001) // true

// 15 decimal places (float64 limit)
fmt.Println(math.Abs(a-b) < 1e-15) // true