logoalt Hacker News

Wowfunhappy • yesterday at 3:57 PM • 1 reply • view on HN

> I think the key to this is that one should not look at 0.99999999.... as a regular decimal or a number in itself. Unlike finite decimals like 0.1235, infinitely continuing ones don't have an immediate physical interpretation.

But it's not clear to me why. It's not an estimation like 3.14159... where the sequence would go on forever and I can't write the exact value. I know exactly what 0.1666... is.

The number 0.8 is really 0.8000... so in a sense nothing ever terminates. The only difference between 0.8000... and 0.1666... is that one continues with zeroes and one with sixes.


Replies

sparkie • today at 8:59 AM

Think of it like a recursive process which terminates for 0, but produces an infinite recursion for anything else.

    repeat_digit(x) = x / 10 + repeat_digit(x / 10)
Since 0 / 10 = 0, 0.0 / 10 = 0, and 0.000 / 10 = 0, and 0 + 0.0 + 0.000 = 0, etc - we know that this produces 0 and could short circuit it to terminate - maybe clearer instead to write:

    repeat_digit(x) =
        if x == 0 then 0
        else x / 10 + repeat_digit(x / 10)

    repeat_digit(0) = 0        ;; terminates
    repeat_digit(9) = 0.999... ;; never terminates