🔢 Integer Arithmetic
and
🔲 Computer sees:
How it works:
Integers are stored as exact binary numbers. Each digit is a power of 2.
Example: 10 = 8+2 = 2³+2¹ = 00001010
ℹ️
Integers are whole numbers. Division throws away decimals!
🔢. Floating Point Arithmetic
and
🔲 Computer sees:
Why the error?
0.1 and 0.2 can't be represented exactly in binary!
It's like trying to write 1/3 in decimal: 0.3333...
How it works:
Floats use scientific notation in binary.
They store: sign, exponent, and fraction
ℹ️
Floats can have decimals but may have tiny precision errors.