From: Steven Jenkins Date: 2004-10-28T07:14:46+09:00 Subject: Re: Rounding error, (100.0 2000 2001 Desktop Money Projects Protege.png Protege_2.1 Q3.DIR Quicken RCS Screenshot-1.png Screenshot-2.png Screenshot-3.png Screenshot.png afs-backup afshome amixer.works b basic.edl bin bruin-woods c4isr.owl c4isr.pprj cellphones.sxc comedi comedilib config config-n6uni config.austin conv-factors.sxc debian drvinfo.txt dry.xml ds-tools emachines evolution float.sxc fnfix foomatic-db-current.tar.gz grp-backup iFog-Aqua20-1.tar.gz id_dsa.pub income jimo-core-sjenkins job-search ken-cole latex2docbook letters lfront log mbse modules n6uni-etc.tar.gz n6uni-home.tar.gz n6uni.tar.gz nasa nisotr old-ruby-tools openafs photos pickaxe2.pdf rdtmerge resume rexml.sxc ruby-bug ruby-oscon.sxi ruby-tidal ruby-tools smbmount.3.0.7 software themes tidal-3-11 tidal-3-5-patches tidal-cvsroot-archive tidal-data tidal-head tidal-poster-corrected.ppt tidal-poster.ppt tidal-web tidal-xdemo tidalsim.tar.gz uuid vim-ruby-snapshot-2003-10-12 wet.xml yepp 9.95).to_i == 994 Hal Fulton wrote: > Expressed as a single number in either base 10 or 2, 0.333... requires an > infinite number of digits (which is all I said). > > Knowing that it is rational, you could separately store the two numbers > expressing > that ratio. But that is completely different from traditional > floating-point storage, > and the simple traditional methods of (e.g.) addition and subtraction > would not > work. It's been done. Google for "matula floating slash". As a graduate student long ago, I did a little Fortran programming on the topic for David Matula. It's also worth pointing out that, from an information-theoretic point of view, you can also represent irrational numbers in a finite number of bits. For example, 'pi' or 'sqrt(2)'. But, as you note, that may not be the most convenient representation for doing arithmetic. Steve