This is the mail archive of the libc-alpha@sources.redhat.com 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]

Re: glibc conditioning


glibc is 100% correct.  Any implementation which produces a different
result deliberately returns a wrong result from strtod().  ISO C
doesn't require the result to be correct so those implementors
unfortunately cannot be held responsible but it does not make the
result correct.  Do the math.

Whoever writes code which assumes something different cannot be
trusted and people who use this software should be aware of this.  And
obviously the author of the test program in the "document" referenced
cannot even write code seven lines of code without a bug since I
guarantee you the program fails everywhere.  Who would listen to
somebody like that?

If you rely on rounding use the appropriate function.  Use round()
instead of a cast to int.  The latter is required to truncate, the
former, as the name suggests, rounds.  And yes, round() is a standard
function.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


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