From: Rick DeNatale Date: 2009-12-27T11:14:31+09:00 Subject: Re: Trig value errors On Sat, Dec 26, 2009 at 12:45 PM, Robert Klemme wrote: > On 26.12.2009 15:43, Rick DeNatale wrote: >> >> On Sat, Dec 26, 2009 at 4:56 AM, Brian Candler >> wrote: >> >>> Floating-point can represent smaller increments the closer you get to >>> zero. So values of 0 +/- dX can be represented much more accurately than >>> 1 +/- dX. >> >> Strictly speaking they can be represented much more precisely. > > Are you sure you meant "precisely" and not "accurately"?  Given the > Wikipedia article you quote it seems _that_ is what you rather wanted to > say. No I meant what I said, although I might have picked a better source to quote. Precision refers to the smallest increment between floating point numbers, the smaller the exponent the smaller the value of the least sign, so one might be able to represent both 0.000000001 and 0.000000002 but, say 10000000.000000001 would have to be represented as 10000000.00 because you only have so many digits Now one might compute a value of Pi as 3.14 which would be more accurate, although less precise than a miscalculated value like 4.3259890880890 One of the mistaken notions of novice programmers is to expect that large amounts of precision in floating point arithmethic are always good. However, in doing calculations with physical measurements of various precisions, one can't get any better precision than what you start with. One can be fooled that the low order digits of calculations represent precision that really isn't there, and if one isn't careful about things like the order of floating point operations when dealing with either very close or very distant values, accuracy can easily be lost. http://docs.sun.com/source/806-3568/ncg_goldberg.html -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale