Re: surprising precision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/04/2010 03:53 PM, Steve Teale wrote:
> On Wed, 2010-03-03 at 16:52 -0500, John S. Fine wrote: 
>> Part of your confusion is over the difference between "precision" and 
>> "accuracy".
>>
>> A floating point format has a FINITE number of specific values that can 
>> be stored with infinite accuracy.  You happen to have chosen values that 
>> are in that finite set.
>>
>> You can set the precision of your output to whatever (finite value) you 
>> like.  It may be much more than the accuracy of your number.  It may be 
>> much less than the accuracy of your number (especially if the accuracy 
>> of your number is infinite).
>>
>> Even if the accuracy of a stored floating point number is infinite, it 
>> may be possible for the algorithm that converts it from binary to 
>> decimal to introduce some inaccuracy.  I'm not sure of those details.  
>> Your results seem to indicate that translation is done surprisingly well.
>>
>> To help you understand, instead of outputting just d each time, output 
>> both d and d+1.  At some point d will still be 100% accurate but d+1 
>> will not be accurate, in fact it will be exactly equal to d.
> 
> John,
> 
> Congratulations on a helpful answer. Yours was the first one that did
> not display the almost conventional GCC guru arrogance.
> 
> GCC would have a lot more participants/helpers if it were not for this
> unwritten convention of rudeness in the community.
> 
> To be fair, this isn't just a GCC thing. I've worked in various shops
> where the software paid the wages, but if a new employee asked for help
> he/she would get a similar response.
> 
> I understand the impatience of the gurus. If they tried to answer every
> naive question they'd never get any work done
> 
> But, if you don't have anything helpful to say, then maybe it's better
> to bite your tongue! The person you are responding to may be an idiot,
> but he/she is not the only recipient of your message.

I strongly disagree.  The main problem may have been that the OP
didn't understand floating-point arithmetic, so the advice to find out
about that was appropriate.  Let's see what the OP says.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux