This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Surprising Behavior Comparing Floats
- From: Nick <nospam at codesniffer dot com>
- To: Rob <robpilling at gmail dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>
- Date: Sat, 11 Jan 2014 10:54:58 -0500
- Subject: Re: Surprising Behavior Comparing Floats
- Authentication-results: sourceware.org; auth=none
- References: <1389453495 dot 1716 dot 13 dot camel at nimble dot 325Bayport> <alpine dot DEB dot 2 dot 02 dot 1401111522280 dot 4756 at egbert>
On Sat, 2014-01-11 at 15:24 +0000, Rob wrote:
> On Sat, 11 Jan 2014, Nick wrote:
> > I'm very surprised by the result in #6. #7 seems to be doing the same
> > thing, except that it uses a local variable to hold the sum.
>
> Sounds to me like it could be related to excess precision - checkout the
> -ffloat-store option. I don't see it on my machine either way, but I'm
> on 4.7.2.
Thank you very much! The -ffloat-store option not only addresses the
behavior I'm seeing, but the information in the man page for this option
gives me a great starting point for information about why it behaves
that way.
Best regards,
Nick