This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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]

[Bug libc/4943] Inconsistent rounding behaviour for sprintf and IEEE doubles


------- Additional Comments From vincent+libc at vinc17 dot org  2007-09-21 23:43 -------
(In reply to comment #12)
> > Now, C99 describes the behavior of the printf family in 7.19.6.1#13. For the
> > examples given in this bug report, C99 says that the result should be
> > correctly rounded. C99 does not say which result should be returned in case
> > of a tie, but in practice, it relies on the definition given in IEEE-754.
> 
> This is interesting.  I wonder whether we could dig up a definition for the
> phrase "correctly rounded".

It is defined by C99 in the section "Terms and definitions". Perhaps you should
take a bit time to read the standards.

> You already know my opinion on what is meant by the
> phrase.  Again, are we not assuming too much about the scope of the IEEE-754? 
> From what I understand, that document is describing how to round the result of
> calculations, not how to round decimal numbers arithmetically.

IEEE-754 covers the arithmetic operations, the square root, binary format
conversions, binary FP <-> integer, *and* binary <-> decimal conversions (I've
already mentioned Section 5.6 twice, have you read it?). All of these operations
basically correspond to a math function over the real numbers, then a rounding
operation.

> As you say, there are many more numbers that are inexactly stored than those
> which are exact.  It took a while for us to find the fact that our reports
> were sometimes generating the wrong numbers.  It works most of the time.  Our
> problem is that those reports are being used by investment houses to make
> decisions sometimes worth billions, and we just cannot have those decisions
> made against wrong numbers.

Before reporting inexistent bugs, I think you should really learn more about
standards and computer arithmetic, probably starting with:
  http://www2.hursley.ibm.com/decimal/

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4943

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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