Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Fw: Useless sNaNs... or useful?



On 2010-10-18 18:32:15 +0100, N.M. Maclaren wrote:
> On Oct 18 2010, Vincent Lefevre wrote:
> >Actually that was a problem with the old IEEE 754-1985 standard,
> >which didn't specify what a destination was (in C, such problems
> >are more due to non-C conformance).
> 
> Not in my experience.
> 
> While there have been a few compiler bugs,

By "such problems are more due to non-C conformance", I was really
talking about a GCC bug (which has been fixed, but one needs
-std=c99 or something similar).

> the vast majority of such problems were because the programmers
> didn't understand C's rules on when values are required to be
> converted to their semantic type. I can witness that there were
> heated debates within WG14 on this, but no consensus on precisely
> what a compiler was allowed to do.
> 
> At least at one stage, the consensus seemed to be that footnote 52
> (which is informative under ISO rules) was in fact normative (i.e.
> that only casts and assignment need convert, but others may).

The footnote is there only for those who don't know how to interpret
the standard correctly. So, the fact that it is informative doesn't
matter. If what you think the standard implies contradicts the
footnote, then this means that your interpretation is incorrect.

But IMHO it would be better if the rule 6.3.1.8#2 (The values of
floating operands and of the results of floating expressions may
be represented in greater precision and range than that required
by the type) were removed. It is harmful, and even useless from a
performance point of view since such optimizations can be handled
under the contraction of floating expressions. So, there would be
two modes: one (contraction disabled) in the spirit of IEEE 754,
and one (contraction enabled) where the implementation is free to
do transformations on a floating expression as long as the local
accuracy is not degraded (typically using extended precision and
range, transforming a*b+c into a FMA, and so on).

-- 
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)