Treating float32 as exact real arithmetic causes surprising results. Go stores values approximately because infinitely many real numbers must fit into 32 bits. FP32 follows IEEE-754: one sign bit, an 8-bit exponent, and a 23-bit mantissa. section 3.3
A multiplication that loses digits
var n float32 = 1.0001 fmt.Println(n * n) The mathematical result is 1.00020001, but the stored FP32 approximation produces 1.0002 on most x86 processors. The value stored for 1.0001 is approximately 1.000100016593933, not the exact decimal. section 3.3
var n float32 = 1.0001 fmt.Println(n * n)
Run the minimal Go example to observe FP32 rounding directly. section 3.3
Keep these consequences in mind:
- Floating-point arithmetic approximates real arithmetic, so precision can be lost. section 3.3
- The representation uses the form sign × 2^exponent × mantissa; conversion internals are intentionally not developed further. section 3.3


