How Floating Point Works: IEEE 754, 0.1 + 0.2, NaN and double vs decimal
0.1 + 0.2 isn't 0.3 because a double stores numbers in base 2 with a sign, an exponent and a 52-bit mantissa, and 0.1 can't be written exactly in that base. The binary64 bit layout, gaps that widen as numbers grow, ±0, NaN and subnormals, comparing with relative tolerance, Half/float/double/decimal, the saturating conversions of .NET 9 and .NET 11, banker's rounding and culture-dependent parsing.
14 Nov 2026
·
13 min
·
5