what I am saying is Binary can only express whole numbers. there are no fractions or decimals in binary.
This isn’t exactly true. Binary is just Base-2 math
Take a 4 bit number: 1001
The right most bit represents 2 ^ 0.
The bit left of it represent 2 ^ 1.
The bit left of that represents 2 ^ 2.
The left most bit represents 2 ^ 3.
1001 = 2 ^ 3 + 2 ^ 0 = 9
Now, if we add decimal places, what happens?
1001.1001
We continue the pattern. To the right of the decimal place, we have 2 ^ -1, 2 ^ -2, 2 ^ -3, 2 ^ -4.
Which breaks (on the right side of the decimal point) down to:
1/2 + 0 + 0 + 1/16
When combined, we get 1001.1001 = 9 + 9/16…
Which is where floating point errors come from, as there’s no way to represent something as simple as 1/10 in binary math. (Just as decimal math can’t ever truly represent 1/3. It’s 0.333333333333333333333333333333333333…..)
Binary math includes decimals. They’re just in bases of 2, halved/doubled at each step of the way.