Your example works because integers are rational IEEE floating point
numbers. Problems arise when you use a number that’s a rational
decimal
number, but an irrational IEEE binary floating point one. Those aren’t
precise no matter what storage size you use.
I understand what you’re trying to say, but ‘rational’ and
‘irrational’ are the wrong terms. 0.2 = 2/10, therefore it’s a
rational number (it can be expressed exactly as a ratio), but it
can’t be represented exactly as a base 2 floating-point number.
Whether a number is rational (like 0.2) or irrational (like sqrt(3))
is a basic mathematical property of the number; it has nothing to do
with how it’s represented.