| View previous topic :: View next topic |
| Author |
Message |
thales1
Joined: 06 Sep 2007 Posts: 5
|
Posted: Thu Sep 06, 2007 6:39 am Post subject: 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?
Thanks.
_____________________________________________
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 |
|
| Back to top |
|
 |
donb
Joined: 20 Jul 2004 Posts: 82 Location: The Portland Group, Inc.
|
Posted: Thu Sep 06, 2007 12:37 pm Post subject: |
|
|
| Our debugger team is investigating this issue. Please stay tuned. |
|
| Back to top |
|
 |
thales1
Joined: 06 Sep 2007 Posts: 5
|
Posted: Thu Oct 11, 2007 5:46 am Post subject: |
|
|
Any news on this issue?
Thanks |
|
| Back to top |
|
 |
donb
Joined: 20 Jul 2004 Posts: 82 Location: The Portland Group, Inc.
|
Posted: Thu Oct 11, 2007 12:24 pm Post subject: |
|
|
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?
thanks |
|
| Back to top |
|
 |
thales1
Joined: 06 Sep 2007 Posts: 5
|
Posted: Fri Oct 12, 2007 2:29 am Post subject: |
|
|
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.
Thanks |
|
| Back to top |
|
 |
|