Re: how long is double
From: Thomas Mang (a9804814_at_unet.univie.ac.at)
Date: 01/04/04
- Next message: Sumit Rajan: "Re: [OT?] C++ Standard - 14882:2003"
- Previous message: Jack Klein: "Re: how long is double"
- In reply to: f: "how long is double"
- Next in thread: Francis Glassborow: "Re: how long is double"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 4 Jan 2004 06:25:34 -0500
f schrieb:
> I have this
>
> double sum, a, b, c;
> sum = a + b + c;
> printf("%.20f = %.20f, %.20f, %.20f", sum, a, b, c);
>
> I found that the debug version and release version of the same code
> give me different result. I am using VC++ 6.0.
Your code yields undefined behavior, because sum, a, b and c have never
been initialized before using them for computations / printing.
So the outcome of the program is undefined, thus anything might happen -
and different outcome between debug and release version is just one
possibility.
regards,
Thomas
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
- Next message: Sumit Rajan: "Re: [OT?] C++ Standard - 14882:2003"
- Previous message: Jack Klein: "Re: how long is double"
- In reply to: f: "how long is double"
- Next in thread: Francis Glassborow: "Re: how long is double"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|