On 2005-05-31 13:16:55 +0100, Andrew Haley wrote: > Vincent Lefevre writes: > > According to 5.1.2.3#13, 6.3.1.5#2 and 6.3.1.8#2, the assert should > > not fail (unless the division yields a NaN, but that would be a very > > bad implementation anyway). > > I have read the sections you mention, and I cannot see how they imply > what you write. Can you explain, please?
Consider the example: #include <assert,h> volatile float x = 3; int main() { float a = 1 / x; x = a; assert(a == x); } Concerning the line "float a = 1 / x;", 1 / x may be computed in any extended precision, but when assigned to a, the result must be converted to float (precision and range). Then concerning the line "x = a;", since the type is the same, the value is unchanged. And in the assert, a and x should have exactly the same value, so that the comparison should return 1 (i.e., true). -- Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/> Work: CR INRIA - computer arithmetic / SPACES project at LORIA