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

Re: Conflicts between C standard and 754-2008

On 2011-01-01 16:51:11 -0500, Michel Hack wrote:
Fred Tydeman mentioned
C1X (currently being voted on) can be found at:

Why does this document -- claiming a base date of 2010 -- not have
even a hint of IEEE 754-2008?  The 1985 standard expired years ago...

Because most work was done before IEEE 754-2008 got finalized?
The implementations are also a problem. For instance, GCC still
doesn't implement C99 very well concerning the floating-point

On <http://gcc.gnu.org/c99status.html> the only feature marked as
broken is "IEC 60559 (also known as IEC 559 or IEEE arithmetic)

I'm glad though that it fixes the overflow issue -- though as
Nick MacLaren points out in his stds-1788 reply, the fix now
simply leaves overflow handling for directed rounding just
plain UNDEFINED, which could be considered a step backwards.

I disagree that it is undefined (see below).

Or does the cited extract from Annex F:
  "Functions such as strtod that convert character sequences
   to floating types honor the rounding direction."
imply a proper result definition for overflow?  I don't think
so, as returning zero could also "honor the rounding direction"!

This is not completely defined for the underflow, but the overflow
is perfectly defined.

Zero would often be forbidden by the following recommendation:

    If the subject sequence has the decimal form and at most
    DECIMAL_DIG (defined in <float.h>) significant digits, the result
    should be correctly rounded. If the subject sequence D has the
    decimal form and more than DECIMAL_DIG significant digits,
    consider the two bounding, adjacent decimal strings L and U, both
    having DECIMAL_DIG significant digits, such that the values of L,
    D, and U satisfy L â D â U. The result should be one of the (equal
    or adjacent) values that would be obtained by correctly rounding L
    and U according to the current rounding direction, with the extra
    stipulation that the error with respect to D should have a correct
    sign for the current rounding direction.

and F.5 says:

    Conversions involving IEC 60559 formats follow all pertinent
    recommended practice. In particular, conversion between any
    supported IEC 60559 format and decimal with DECIMAL_DIG or fewer
    significant digits is correctly rounded (honoring the current
    rounding mode), which assures that conversion from the widest
    supported IEC 60559 format to decimal with DECIMAL_DIG digits and
    back is the identity function.

Vincent LefÃvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / ArÃnaire project (LIP, ENS-Lyon)

754 | revision | FAQ | references | list archive