Re: Conflicts between C standard and 754-2008
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
To Vincent Lefèvre, who dug up extra and conflicting information about
directed rounding: Thank you very much! So how does one go about
opening a defect against a standard?
Btw, this matters to the IEEE 1788 crowd, where I shall post next.
On hex strings: based on the adage "be lenient on input and strict on
output" I would say that scanf() (e.g. via strtod()) should accept 0x123
but that printf() should produce 0x123p0 when asked for hex conversion.
As for "0xgarbage", I came to the somewhat unhappy conclusion that it
has to be parsed as a valid "0" terminated by "xgarbage", and will fix
my parser. Linux seems to do this; AIX actually eats "0x" because it
appears to accept zero given digits (it would eat "0xp-1" too) as the
value zero (which must be seen as a bug).
---Sent: 2011-01-01 03:21:25 UTC