This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Precision of doubles and stdio

Roberto Bagnara wrote on Monday, March 06, 2006 9:30 AM::
> what is and what is not noise depends on the application.
> In our applications we systematically use controlled rounding on IEEE
> 754 floating point numbers.  In the end, what we obtain (in memory)
> are definite (i.e., provably correct) lower or upper bounds of some
> quantities.   
> Call `x' such a quantity, and suppose we have that our computed upper
> bound for `x' is the IEEE 754 Double Precision number 
>      0x4051b9999999999a,
> that is (exactly!),
>      70.900000000000005684341886080801486968994140625.
> If that number is (wrongly!) printed as
>      70.90000000000000568434188608080148696899414
> then we lose correctness, since
> x <= 70.900000000000005684341886080801486968994140625
> does not imply
> x <= 70.90000000000000568434188608080148696899414.
> So, the final "0625" is not "noise" in our applications:
> it is what may make the difference between a correct statement and an
> incorrect one. 

I'm absolutely amazed that you are a professor of computer science!

If I had written software that relied on the _exact_ meaning of the
significant digit of a floating point number (either at university, or
work), I would have been the subject of ritual humiliation!

You should NOT be using floating point numbers for such an application.
Floating point numbers are _approximate_ representations of the 
continuous number series that shares the same approximate value.  That 
the IEEE format is an integer multiplied by some power of two is an 
implementation detail.  Floating point hardware is frequently not 100% 
accurate in the LSB of the mantissa due to internal rounding errors and 
the datasheets will often tell you so.

That being said, the thing which completely floors me is that you are 
relying on behaviour which is clearly beyond that given in the language 
specification.  This is one of the most rudimentary mistakes in
programming.  Frankly, this is beyond belief for someone in your
C doubles are accurate to 16 or 17 decimal places, if you expect 48
significant figures then you deserve all the bad results you get.

That you should then choose a public forum (and the wrong one at that!)
to complain about this is astounding.

Ask yourself this: if your brain surgeon uses an axe, will the inquest 
find the axe at fault or the surgeon?

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the H.E Information Systems Ltd. 
Tel:    0161 866 9066

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]