From: Marnen Laibow-Koser Date: 2009-11-17T01:19:15+09:00 Subject: Re: Trajectories Paul Smith wrote: [...] > No, I really mean your two points. > > On the one hand, you say "If it gives you the wrong answer, it's a > bug. Period. If your representation cannot give you the precision > you need for the task at hand, then you need a different > representation. Period." > > Then you say "No, becuase [representing irrational numbers is] > impossible to do with a finite representation AFAIK. If I'm wrong, I > would love to know how this can be done." Interesting question. I don't think that's a contradiction so much as an acknowledgement of the fundamental limitations of digital computing. With data structures like BigDecimal and Rational, we can exactly represent any rational number we like in a finite amount of storage. Irrational numbers are different. We could represent them exactly on an analog computer such as a slide rule, but there is no general method that I am aware of for doing so in a finite amount of digital storage. Certain numbers, such as square roots, can be represented with tricks like quadratic equations to which they are the root, but that won't work for transcendental numbers like e or π. We can calculate those numbers to millions of decimal places if we need to -- but unlike rational numbers, we can never store them exactly. So we do the best we can. Since rational numbers can be represented exactly, it makes sense to do so. Since (many) irrational numbers cannot be represented exactly, we get as close as we can. > >>>> >> Posted via http://www.ruby-forum.com/. >> >> > > > > -- > Paul Smith > http://www.nomadicfun.co.uk > > paul@pollyandpaul.co.uk Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.