[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decladebug

Title:Digital Ladebug debugger
Moderator:TLE::LUCIA
Created:Fri Feb 28 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:969
Total number of notes:3959

945.0. "Differing floating-point values?" by CXXC::MJHANS (Matthew Hanselman, DEC C/C++) Fri May 02 1997 11:43

    Could you please reply re: whether this is expected behavior or a bug?
    
    Ladebug 4.0-36 behaves slightly differently with some floating point
    values than previous versions did.  Take the line
    
    	set $c = 7.89 + (long)7.89
    
    On versions previous to ladebug 4.0-36, printing out the resulting $c
    would give
    
    	14.89
    
    But ladebug 4.0-36 gives
    
    	1.48899999999999996802557689079549E+0001
    
    Thanks
    
    							- Matt
T.RTitleUserPersonal
Name
DateLines
945.1TLE::LUCIAhttp://asaab.zko.dec.com/~lucia/biography.htmlFri May 02 1997 12:3023
This is a result of the newest long double support.  Ladebug now does everything
in the "widest" of the floating types available.  In the case of floating point
literals, they are done in long double, hence the difference you are seeing.

It is okay.

float op float = float [real*4]
double op double = double [real*8]
float op double = double [real*8]
float op long double = long double [real*16]
.
.
.

In many cases, I've checked that if:

long double x;

if ((long double)((double)x)) == x then display x using double to minimize the
"noisy bits".  In this case, nothing is ever a double, so this step is skipped.


Tim
945.2Something is still wrongWIBBIN::NOYCEPulling weeds, pickin' stonesFri May 02 1997 15:088
>    	set $c = 7.89 + (long)7.89
>
>    	1.48899999999999996802557689079549E+0001

Clearly, some part of the computation was done in double (64 bits) but the
display was done in long double (128 bits).  I would guess that the conversion
of "7.89" to a binary floating-point value was done in double -- is it supposed
to be done in the widest floating type?
945.3TLE::LUCIAhttp://asaab.zko.dec.com/~lucia/biography.htmlFri May 02 1997 16:2810
Good catch Bill... The lexer/parser creates a double, not a long double.

HEY CHARLIE -- ARE WE GOING TO HAVE long double SUPPORT IN C++??

This is the real cause of the problem, since we're trying to minimized the
amount of non C++ code in the debugger...

I'll put this back on my plate.

Tim
945.4-real16 or -Wf,-real16DECCXL::OUELLETTEmudseason into blackfly seasonFri May 02 1997 19:133
There's a switch on the V6.0 C++ compiler...
There are a whole raft of library and name mangling issues to be solved
before you'd really want to use it though.