This is the mail archive of the
mailing list for the GCC project.
Re: Draft "Unsafe fp optimizations" project description.
- To: dewar at gnat dot com, lucier at math dot purdue dot edu
- Subject: Re: Draft "Unsafe fp optimizations" project description.
- From: dewar at gnat dot com
- Date: Mon, 6 Aug 2001 20:58:11 -0400 (EDT)
- Cc: gcc at gcc dot gnu dot org, toon at moene dot indiv dot nluug dot nl
>>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;
Put_Line (Float'Image (b - a));
Put_line (Float'Image (-b + a));
The output of this is
This minus zero stuff is tricky!