On 2005-05-25 19:27:21 +0200, Allan Sandfeld Jensen wrote: > Yes. I still don't understand why gcc doesn't do -ffast-math by > default like all other compilers.
No! And I really don't think that other compilers do that. It would be very bad, would not conform to the C standard[*] and would make lots of codes fail. [*] See for instance: 5.1.2.3 Program execution [...] [#14] EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in precision as well as range. The implementation cannot generally apply the mathematical associative rules for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real numbers are often not valid (see F.8). double x, y, z; /* ... */ x = (x * y) * z; // not equivalent to x *= y * z; z = (x - y) + y ; // not equivalent to z = x; z = x + x * y; // not equivalent to z = x * (1.0 + y); y = x / 5.0; // not equivalent to y = x * 0.2; > The people who needs perfect standard behavior are a lot fewer than > all the packagers who doesn't understand which optimization flags > gcc should _always_ be called with. Standard should be the default. (Is this a troll or what?) -- 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