sin(x) different debug&release-results
Author Message
sin(x) different debug&release-results

Hallo Fellows,
did somebody else experience different double-precision-results in the
trigonometric functions (sin, cos) for the debug and release version of a vc++
6.0 compiled programm.
Well I did, and with the log-function as well.
Why is this so, and does somebody know a workaraound or better still is this
problem history in the new vc++ 7.0?
Hopefully yours, Mic.

Fri, 25 Jul 2003 20:27:30 GMT
sin(x) different debug&release-results
hmm Could you post a sample code showing that (specify switches)?

--

Andrea Ferro

---------
Brainbench C++ Master. Scored higher than 97% of previous takers
Scores: Overall 4.46, Conceptual 5.0, Problem-Solving 5.0

Hallo Fellows,
did somebody else experience different double-precision-results in the
trigonometric functions (sin, cos) for the debug and release version of a vc++
6.0 compiled programm.
Well I did, and with the log-function as well.
Why is this so, and does somebody know a workaraound or better still is this
problem history in the new vc++ 7.0?
Hopefully yours, Mic.

Fri, 25 Jul 2003 21:10:40 GMT
sin(x) different debug&release-results
different double-precision-results in the trigonometric functions "sin"

here is some example code:

int main (int argc, char **argv)
{
long i;
double x=0.89152,y;

for (i=0; i < 10000; i++) {
y=x+i/1000.0;
fprintf(stderr,"sin(%7.5f)=%30.20f\n",y,sin(y));
}
return 0;

Quote:
}

you'll find many, many differences
the first for y=0.96252
sin(0.96252)=        0.82063423604053598000 (debug)
sin(0.96252)=        0.82063423604053609000 (release)

the next for y=1.03452
sin(1.03452)=        0.85961720497862504000 (debug)
sin(1.03452)=        0.85961720497862515000 (release)
and so on, and so on

well, which value is correct now?
the mathematical co-processor (release) or the math-library
(debug) or something else?

Fri, 25 Jul 2003 21:28:22 GMT
sin(x) different debug&release-results
different double-precision-results in the trigonometric functions "sin"

here is some example code:

int main (int argc, char **argv)
{
long i;
double x=0.89152,y;

for (i=0; i < 10000; i++) {
y=x+i/1000.0;
fprintf(stderr,"sin(%7.5f)=%30.20f\n",y,sin(y));
}
return 0;

Quote:
}

you'll find many, many differences
the first for y=0.96252
sin(0.96252)=        0.82063423604053598000 (debug)
sin(0.96252)=        0.82063423604053609000 (release)

the next for y=1.03452
sin(1.03452)=        0.85961720497862504000 (debug)
sin(1.03452)=        0.85961720497862515000 (release)
and so on, and so on

well, which value is correct now?
the mathematical co-processor (release) or the math-library
(debug) or something else?

Fri, 25 Jul 2003 21:28:14 GMT
sin(x) different debug&release-results
hmm Could you post a sample code showing that (specify switches)?

Sample code:
Please see my own "reply" from Feb. 5 2001 5:28 AM.

Thanks, Mic.

Fri, 25 Jul 2003 22:38:57 GMT
sin(x) different debug&release-results

Quote:
> different double-precision-results in the trigonometric functions "sin"

> here is some example code:

> int main (int argc, char **argv)
> {
> long i;
> double x=0.89152,y;

> for (i=0; i < 10000; i++) {
> y=x+i/1000.0;
> fprintf(stderr,"sin(%7.5f)=%30.20f\n",y,sin(y));
> }
> return 0;
> }

> you'll find many, many differences
> the first for y=0.96252
> sin(0.96252)=        0.82063423604053598000 (debug)
> sin(0.96252)=        0.82063423604053609000 (release)

> the next for y=1.03452
> sin(1.03452)=        0.85961720497862504000 (debug)
> sin(1.03452)=        0.85961720497862515000 (release)
> and so on, and so on

> well, which value is correct now?
> the mathematical co-processor (release) or the math-library
> (debug) or something else?

Sorry mic but the answer is that they are both right.
Doubles only have a precision of about 14 decimal digits so there is nothing
wrong when you see a difference in the 16th significant digit.

Fri, 25 Jul 2003 23:52:51 GMT

 Page 1 of 1 [ 6 post ]

Relevant Pages