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

Re: Conflicts between C standard and 754-2008

On Fri, 31 Dec 2010 22:03:06 -0500 Michel Hack wrote:

To Fred Tydeman, who quoted the relevant C99 section:
So, strtod() can do what IEEE-754 requires.

For underflow, yes, but not for overflow:  HUGE_VAL can have only one
value, is the required result on overflow, and yet 754 requires two
different values.

Did you notice that the text I quoted from the C Standard
mentions "default rounding"?  C's Annex F (the IEEE-754 one)
says default rounding is "round to nearest".  So, for
"round to zero" mode, strtod() can return the maximum
finite value, instead of HUGE_VAL (+infinity).  There is
no conflict between C and IEEE-754 on this issue.

Fred J. Tydeman        Tydeman Consulting
tydeman@xxxxxxxxx      Testing, numerics, programming
+1 (775) 358-9748      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.

754 | revision | FAQ | references | list archive