Re:0.30000000000000004
by raiph on Saturday November 14, 2015 @03:04AM
(#10564911)
> 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.
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.