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: What is acceptable for -ffast-math? (Was: associative law in combine)


On Aug  1, 2001, Gabriel Dos_Reis <gdosreis@sophia.inria.fr> wrote:

> | Now, show me a case where a/b/c -> a/(b*c) is significantly less accurate?

> On a 64-bit double processor just take 

> 	b = c = 2 * sqrt(DBL_MAX);
> 	a = 0.5 * DBL_MAX

> a/(b*c) is 0.0 whereas a/b/c yields 0.125.

I'm no expert in FP arithmetic, but it appears to me that this chunk
of code is a materialization of what Linus wrote:

> The one obvious case is (b*c) overflows and turns into Inf, at which
> point the end result will be +-0 with the optimization.

If there is a difference, will you care to enlighten me?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


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