help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: g++ Bug? Why w/ and w/o "O3" options gives different result(g++3.3.3


From: Peng Yu
Subject: Re: g++ Bug? Why w/ and w/o "O3" options gives different result(g++3.3.3) for this program?
Date: Wed, 01 Dec 2004 15:31:15 -0600

I change defines to const numbers. But there results are still
different.

Does it indicate g++ has a bug? Or I used some C++ language feature
that -O3 option doesn't support?

Peng

//#define NA       0.5
double const NA = 0.5;
//#define s        0.5 //for coherent light this is 0.0
double const s = 0.5;
//#define INTEGRAL_PIECES 25
const int INTEGRAL_PIECES = 25;

//#define N        18//34 //should be greater than (1+s)*2 / Delta_f
const int N = 18;

//#define L_x      5.//10 //in the unit of \lambda\mathit{NA}
//#define L_y      5.//10 //in the unit of \lambda\mathit{NA}
double const L_x = 5.;
double const L_y = 5.;

//#define Delta_f  (1./L_x)
//#define Delta_g  (1./L_y)
double const Delta_f = 1. / L_x;
double const Delta_g = 1. / L_y;



On Wed, 01 Dec 2004 18:24:15 +0100, Ulrich Eckhardt
<doomster@knuut.de> wrote:

>Peng Yu wrote:
>
>>>> #define L_x      5//10 //in the unit of \lambda\mathit{NA}
>>>> #define L_y      5//10 //in the unit of \lambda\mathit{NA}
>> 
>> I changed the above statements to
>> #define L_x      5.
>> #define L_y      5.
>
>Noooo.
>
>float const L_x = 0.5f;
>double const L_y = 0.5;
>
>> But the results are still different. It seems that the division isn't
>> the reason.
>
>By point was also that 5//10 is not a division, as it might look at the
>first glance!
>
>Uli



reply via email to

[Prev in Thread] Current Thread [Next in Thread]