This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: -O generates NaN
On Sat, Mar 03, 2001 at 03:01:58PM -0300, Alexandre Oliva wrote:
> On Mar 2, 2001, Haruhiko Okumura <okumura@matsusaka-u.ac.jp> wrote:
>
> > Could someone tell why this code generates lots of NaN's when compiled
> > with any optimization flag (-O, -O2 etc) on?
>
> Probably some of the math optimizations in GNU libc. Not libstdc++.
I concur. On Solaris 8 -- therefore not using GNU libc -- I always see
the same results:
2: 85.9715
6: 85.9715
18: 85.9715
2: 86.5915
6: 86.5915
18: 86.5915
len1 = 85.9715, len2 = 86.5915
That is the output with no optimization, with -O, and with -O3.
Phil
--
pedwards at disaster dot jaj dot com | pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools. Fools are protected by more capable fools.