[Edit removed during grace period]
Joel Coehoorn
• 376.4k
• 109
• 542
• 777
Joel Coehoorn
• 376.4k
• 109
• 542
• 777

It's broken in the exact same way the decimal (base-10) notation you learned in grade school is broken, just for base-2.

To understand, think about representing 1/3 as a decimal value. It's impossible to do exactly! In the same way, 1/10 (decimal 0.1) cannot be represented exactly in base 2 (binary) as a "decimal" value; a repeating pattern after the decimal point goes on forever. The value is not exact, and therefore you can't do exact math with it using normal floating point methods.

Joel Coehoorn
• 376.4k
• 109
• 542
• 777

It's broken in the exact same way decimal (base-10) notation is broken, just for base-2.

To understand, try to convertthink about representing 1/3 toas a decimal value. It's impossible to representdo exactly! In the same way, 0.1 or 1/10 (decimal 0.1) cannot be represented exactly in base 2 (binary); you get as a "decimal" value; a repeating pattern after the decimal point that goes on forever. The value is not exact, and therefore you can't do exact math with it using normal floating point methods.

Joel Coehoorn
• 376.4k
• 109
• 542
• 777