3 ms·
> 0.1 and 0.2 ... are repeating decimals ... Au contraire, `0.1` and `0.2` are non-repeating decimals. Their approximations may be repeating of course, and so
by raiph 11y ago
> 0.1 and 0.2 ... are repeating decimals ...
Au contraire, `0.1` and `0.2` are non-repeating decimals.
Their approximations may be repeating of course, and some languages indulge in such approximations, but there's nothing intrinsic about `0.1` that requires that it be approximated prior to storage rather than stored with 100% accuracy.
Many lisps do what it takes to store rationals as rationals, maintaining 100% accuracy. Perl 6 likewise treats literals of the form `1/10` or `0.1` as the rationals they are, again maintaining 100% accuracy.