Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: .999999... == 1? (Somewhat OT)

by Cybercosis (Monk)
on Jul 25, 2001 at 04:28 UTC ( [id://99529]=note: print w/replies, xml ) Need Help??


in reply to Re: .999999... == 1? (Somewhat OT)
in thread .999999... == 1? (Somewhat OT)

Actually, the statement that .3 repeating == 1/3 is not *entirely* correct. The more you repeat the 3, the closer it gets to actually being 1/3, but it is NEVER EXACTLY 1/3. Try this: divide 9 by 3. The answer is 3. Now multiply 9 by .3. You get 2.7. Multiply by .33 and you get 2.97. Keep adding 3s and you keep adding 9s in the product. What you never get, however, is 3. It may get so close to 3 as to make a distinction meaningless (depending on what you're doing), but 2.99...7 != 3. For the same reason, .33... != 1/3. Apply that to .99... and you get very close to 1, but never quite there. So I chalk the whole thing up to a floating point rounding error. =-)

~Cybercosis

nemo accipere quod non merere

Replies are listed 'Best First'.
Re: Re: Re: .999999... == 1? (Somewhat OT)
by Sherlock (Deacon) on Jul 25, 2001 at 05:11 UTC
    This is really what I was hoping someone would come up with. I expected the barrage of mathematical proofs that prove, without a doubt the .9 repeating is indeed equal to 1. However, in a computer, you can't repeat forever. This concept, although true in the word of theoretical mathematics, does not hold true in the world of computers. Attempt this simple script:

    #!/usr/bin/perl -w use strict; my $num1 = .9999999999999999; my $num2 = 1; print "num1 = $num1\n"; print "num2 = $num2\n"; print "The numbers are equal" if $num2 == $num1; print "The numbers are not equal" if $num2 != $num1;
    You'll notice that these two numbers are indeed unequal. You're probably thinking big deal, obviously, $num1 doesn't repeat forever so they shouldn't be equal. Try the script again, but add a single 9 to the end of $num1. You should find the results more interesting. (I'm by no means a Perl guru and am not sure if this will work the same from one Perl installation to another. I am using Perl 5.6.1 on a Win32 platform.) In that case, the two values, even though $num1 still does not repeat forever, are considered equal.

    What I had come up with, as a refutation to the argument, was that whether .9 repeating is equal to 1 is dependent upon your context. In a mathematical world, it is obviously true. Within a computer, however, it is an entirely different case.

    - Sherlock

    Update: Please note, I am not attempting to say that .9 repeating is not equal to 1 simply because a computer can't represent .9 repeating. I was simply trying to point out that there is some level of discrepency between theoretical mathematics and the mathematics done in a computer/calculator. I was really just hoping this post would cause a few of you (and myself) to think about how you use floating point numbers and make you more aware of the rounding errors that can take place.

    Skepticism is the source of knowledge as much as knowledge is the source of skepticism.
      You're right, you can't represent .9999... exactly in a computer. Neither can you do so on a piece of paper. No matter how small a font you use, you will eventually run out of paper. The best you can do is talk about it, repesent it in various ways, but what you can't do is actually write it out explicitly, make it "real" if you will. Numbers manipulated by calculating devices are restricted to a finite size due to physical limits. Consequently there is a finite number of numbers that can be stored. Therefore a computer is an invalid context for this discussion. .9 repeating to a machine's physical limits is not equivilent to .9999... .9999... simply can not exist in the digital realm. So you are not refuting the argument at all.

      Have fun,
      Carl Forde

      Right, a radix-based system can't directly represent an infinite number of repeating digits.

      But a rational number model can hold this value quite easily. It would hold 9/9 (to represent infinite repeating, use 9 in the denominator, instead of 10). You can see that this is another representation of 1, just like 2/4 and 1/2 are the same value.

      It's not wierd that two distinct numbers, .9999.... and 1, happen to be equal to each other. Rather, they are the same number, just expressed in two different representations in our Aribic positional number notation. In Roman number notation, X is the same number as VV. Big deal.

      —John

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://99529]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-03-28 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found