Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-lcc!ames!ucbcad!ucbvax!decvax!ittatc!bunker!garys From: garys@bunker.UUCP (Gary M. Samuelson) Newsgroups: comp.lang.c Subject: Re: Is .2 irrational? Message-ID: <1404@bunker.UUCP> Date: Thu, 8-Jan-87 13:59:12 EST Article-I.D.: bunker.1404 Posted: Thu Jan 8 13:59:12 1987 Date-Received: Thu, 8-Jan-87 23:36:14 EST References: <442@catnip.UUCP> <7456@utzoo.UUCP> <153@piaget.UUCP> <1384@bunker.UUCP> <568@brl-sem.ARPA> Reply-To: garys@bunker.UUCP (Gary M. Samuelson) Organization: Bunker Ramo, Trumbull Ct Lines: 26 In article <568@brl-sem.ARPA> ron@brl-sem.ARPA (Ron Natalie) writes: >In article <1384@bunker.UUCP>, garys@bunker.UUCP (Gary M. Samuelson) writes: >> A floating point format could >> be designed which allowed exact representation of all decimal fractions, >> up to some number of places precision. > >Gee, how do you deal with 1/3? I'm not sure how I do that even on >a decimal computer. Perhaps you meant that can handle an exact represntation >of all fractions of the form INTEGER/(Power of 10) I did say "up to some number of places precision," which I think covers your objection to my imprecise wording. But if you really want: Define a floating point number as a triple of integers (Numerator, Denominator, Exponent). Let this represent the number (N/D) * B ** E, where B is a constant (e.g., 10). In normalized form, N and D have no common factors, and neither N nor D is divisible by B. As a special case, define (0, 0, 0) to represent zero. Formal analysis of this scheme, including proofs that each representable number would have a unique normalized form, or that its arithmetic would be well defined, is left as an exercise to the reader. (However, if someone wants to pay my living expenses while I pursue this line of research, let me know :-). Gary Samuelson