Re: Compiler optimization and floating point operations

"Steven G. Kargl" <sgk@troutmask.apl.washington.edu>
Thu, 24 Oct 2013 16:38:13 +0000 (UTC)

          From comp.compilers

Related articles
Compiler optimization and floating point operations abidmuslim@gmail.com (Abid) (2013-10-23)
Re: Compiler optimization and floating point operations cameron.mcinally@nyu.edu (Cameron McInally) (2013-10-23)
Re: Compiler optimization and floating point operations gah@ugcs.caltech.edu (glen herrmannsfeldt) (2013-10-24)
Re: Compiler optimization and floating point operations gneuner2@comcast.net (George Neuner) (2013-10-24)
Re: Compiler optimization and floating point operations jm@bourguet.org (Jean-Marc Bourguet) (2013-10-24)
Re: Compiler optimization and floating point operations sgk@troutmask.apl.washington.edu (Steven G. Kargl) (2013-10-24)
Re: Compiler optimization and floating point operations gneuner2@comcast.net (George Neuner) (2013-10-24)
Re: Compiler optimization and floating point operations gah@ugcs.caltech.edu (glen herrmannsfeldt) (2013-10-24)
Re: Compiler optimization and floating point operations christian.bau@cbau.wanadoo.co.uk (2013-10-28)
Re: Compiler optimization and floating point operations christian.bau@cbau.wanadoo.co.uk (2013-10-28)
Re: Compiler optimization and floating point operations cameron.mcinally@nyu.edu (Cameron McInally) (2013-10-28)
| List of all articles for this month |
From: "Steven G. Kargl" <sgk@troutmask.apl.washington.edu>
Newsgroups: comp.compilers
Date: Thu, 24 Oct 2013 16:38:13 +0000 (UTC)
Organization: A noiseless patient Spider
References: 13-10-026 13-10-029 <13-10-030 @comp.compilers>
Keywords: arithmetic, comment
Posted-Date: 24 Oct 2013 16:44:01 EDT

On Thu, 24 Oct 2013 15:51:59 +0200, Jean-Marc Bourguet wrote:


> George Neuner <gneuner2@comcast.net> writes:
>
>> [I think you mean they're not associative. I don't know any situations
>> where a+b != b+a, but lots where a+(b+c) != (a+b)+c -John]
>
> You forgot about NaN ;-) (but I agree associative was probably intended).
>
> Yours,
> --
> Jean-Marc [How are NaNs not commutative? -John]


I believe Jean-Marc is referring to something like the following


#include <stdio.h>
int
main(void)
{
      float a, b;
      a = 0.;
      b = a / a;
      if (a + b != b + a) printf("fubar\n");
      return (0);
}


Can an optimizing compiler eliminate the if-statement?


--
steve
[If it does sufficient dataflow and constant substitutions so it can tell
that a+b will always be a NaN, I don't see why not. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.