Re: how long is double

From: Cy Edmunds (cedmunds_at_spamless.rochester.rr.com)
Date: 01/04/04


Date: Sun, 04 Jan 2004 02:43:49 GMT


"f" <ffunus@yahoo.com> wrote in message
news:8f4ce98a.0401031338.4208ac8@posting.google.com...
> I have this
>
> double sum, a, b, c;
> sum = a + b + c;

You used a, b, and c without initializing them. Was this your intent?

> 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.
>
> In debug version, the print out is:
> -12.25938471938358500000 = -11.43596388399630500000,
> -0.07591666113607631300, -0.74750417425120252000,
>
> In the release version, the print out is:
> -12.25938471938358300000 = -11.43596388399630500000,
> -0.07591666113607631300, -0.74750417425120252000,

Looks the same to me. And where is that trailing comma coming from?

>
> The above sum = a + b + c is just a part of my computation. I found
> that my whole computation crushed in the debug version because some
> number became zero and another number divide this number. But this did
> not happened in the release version.

Perhaps you can coax The Great Carsoni out of retirement. Or post some code.

>
> Why?
>
> Thanks,
>
> ff
>
> [ See http://www.gotw.ca/resources/clcm.htm for info about ]
> [ comp.lang.c++.moderated. First time posters: Do this! ]

Your massive crossposting is very bad usenet manners.

-- 
Cy
http://home.rochester.rr.com/cyhome/


Relevant Pages

  • Problem related with open and close database
    ... i have application with ms-access database in vc++.while initializing ... database with different tables and corresponding fileds,one run time error ... it goes in debug and release mode. ...
    (microsoft.public.data.odbc)
  • Problem Related with open and close table in ODBC connection
    ... i have application with ms-access database in vc++.while initializing ... database with different tables and corresponding fileds,one run time error ... it goes in debug and release mode. ...
    (microsoft.public.vc.database)
  • Problem related with open and close database connection in ODBC
    ... i have application with ms-access database in vc++.while initializing ... database with different tables and corresponding fileds,one run time error ... it goes in debug and release mode. ...
    (microsoft.public.access.dataaccess.pages)
  • Re: how long is double
    ... > I found that the debug version and release version of the same code ... Your code yields undefined behavior, because sum, a, b and c have never ...
    (comp.lang.cpp)
  • Re: how long is double
    ... > double sum, a, b, c; ... > I found that the debug version and release version of the same code ... Apparently the discrepancy is between -12.25938471938358500000 ... intermediate register, and in debug mode ...
    (comp.lang.cpp)