Floating point precision in the debugger

I can’t get enough digits when printing out double precision variables in the debugger. Older version of PGF printed out many more digits.
Example :
a is a double precision variable with value : 18886.624629629601
The GNU debugger (GDB) prints out : 18886.624629629601 (good)
In the PGF debugger (PGDBG):
pgdbg> print a
18886.625 (correct but not accurate enough)
pgdbg> print a - 18886.625
0 (not accurate enough)
pgdbg> print a - 18886.62
0.0050000000010186341 (not accurate enough, only the first non zero digit is significant )
pgdbg> printf “%16.10f”,tdeb
0.0000000000 (wrong)
pgdbg> printf “%f”,tdeb
0.000000 (wrong)
pgdbg> printf “%G”,tdeb
0 (wrong)
pgdbg> dread &tdeb

pgdbg>print &tdeb
(real*8 ) 0xa021100 18886.625
pgdbg> dump 0xa021100,1,"%G"
0xa021100: 0

Is there a way to get (easily) many more digits?


PGF version : pgf90 6.1-3 32-bit target on x86 Linux
System : Redhat Enterprise Linux 4, Linux 2.6.9-5.ELsmp #1 SMP i686 i686 i386 GNU/Linux

Our debugger team is investigating this issue. Please stay tuned.

Any news on this issue?


Sorry for the delay in responding.

In your scenario, are you setting this variable using a constant (literal)?

Fortran constants are 4 byte (REAL*4) unless explicitly declared otherwise.

real*8 :: d2 = 18886.624629629601_8 ! 8 byte constant with value 18886.624629629601

real*8 :: d1 = 18886.624629629601 ! 4 byte constant with value 18886.625

Can you clarify whether this is the case?

All real values in our programs are double precision variable.
Most of them are computed. Some come from input file. When they are initialized with a constant, we put a “d” at the end of the value, like this :
x = 1.0d.

The problem is only with the debugger because the programs work and output the good values with all the required digits.
I remember that the debugger from older version of PGF (it was console only on Linux) did a good job.

The GNU debugger also prints the required digits, but unfortunately it can’t read some of the variables (for example Fortran 90 structures) because it doesn’t understand all the symbols in the PGF binary.

This is really bothering because we need many more digits to debug our programs.


I made a mistake in the previous post. Inits are done like this :
x = 1.0d0
with an exponent after the “d”

Try this?

printf “%18.12f”,d1


I already tried that : see first post : all printf statements return “0.000000” whatever the value of the variable.


Do you have access to 7.0 or 7.1 release?
It prints correctly with those releases.