Draft "Unsafe fp optimizations" project description.

dewar@gnat.com dewar@gnat.com
Mon Aug 6 17:58:00 GMT 2001


>>I can't think of a case where -A+B != B-A.  Can you give us an example?

Here is an Ada program to answer your question :-)

(probably you can read this even if you don't know Ada :-)

with Text_IO; use Text_IO;
procedure k is
   a : float := -0.0;
   b : float := +0.0;

begin
   Put_Line (Float'Image (b - a));
   Put_line (Float'Image (-b + a));
end;

The output of this is

 0.00000E+00
-0.00000E+00

This minus zero stuff is tricky!



More information about the Gcc mailing list