A common mistake is expecting floating-point calculations to match real arithmetic exactly. Go's float32 and float64 use finite precision, so fractional values may be approximated and lose precision. section 3.3
The surprising multiplication result
Multiplying 1.0001 by itself may print 1.0002 rather than the expected 1.00020001. In float32, 1.0001 is stored approximately as 1.000100016593933, so the calculation starts with a different value. section 3.3
Use these details to diagnose the result:
- float32 allocates 8 exponent bits and 23 mantissa bits; float64 allocates 11 exponent bits and 52 mantissa bits, with one remaining sign bit. section 3.3
- Accumulation order affects error: repeatedly adding 1.0001 to 10,000 produces different results from adding it to zero and adding 10,000 afterward. section 3.3



















