Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!mips!apple!agate!e260-2b!c60b-4ah From: c60b-4ah@e260-2b.berkeley.edu (Phantom) Newsgroups: comp.sys.mac.programmer Subject: Re: Why can't the Mac add? Message-ID: <1990Sep24.014125.25065@agate.berkeley.edu> Date: 24 Sep 90 01:41:25 GMT References: <45060@apple.Apple.COM> <1990Sep24.010249.16647@agate.berkeley.edu> <8614@jarthur.Claremont.EDU> Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: University of California, Berkeley Lines: 31 (As a result of some distraction, I have accidentally mismanipulated the cardinality of my last posting. I hope that that has been corrected and the old article has been engulfed by oblivion. The following is the normalized version. I sincerely apologize for the anarchy it has caused in the set of all sets.) With all respect, I was somewhat surprised to learn that some person from Apple should not know this. I shall refer anyone who is intrigued by this to the SANE manual published by Addison-Wesley (Someone in Apple wrote it!) But I will discuss it briefly here. No matter what base is chosen to represent even ration number, there are countablely infinite fractional rational numbers that cannot be represented in finite digits. Suppose the base used is N, which is divisible by the prime numbers p1, p2, p3, ... pk. Suppose further that fractional part of the number you want to represent (call it X) in that system can be written in the form Q --------------------- R , where both Q and R are integers, whose Greatest Common Divider is 1. Let s1, s2, ... sl be all the prime facotors of R, and t1, t2, ... tm be all the prime factors of N, then the necessary and sufficient condition for X to be representable in finit number of digits in base N is that the set { s1, s2, ... sl } is a subset of the set { t1, t2, ... tm }. In you example, the number 0.2=1/5 cannot be exactly represented in a finite sequence of 0's and 1's because 2 <> 5. In fact, 0.5 in binary notation is 0.0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 ...