This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Draft "Unsafe fp optimizations" project description.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]