Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by Sherlock (Deacon)
on Jul 25, 2001 at 05:11 UTC ( [id://99534]=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re: Re: Re: Re: .999999... == 1? (Somewhat OT)
by cforde (Monk) on Jul 25, 2001 at 10:00 UTC
    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

Re: Re: Re: Re: .999999... == 1? (Somewhat OT)
by John M. Dlugosz (Monsignor) on Jul 25, 2001 at 19:40 UTC
    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://99534]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found