Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Another debugging issue - gives wrong values

$
0
0

The following source code runs fine as far as the PRINT statements go -

But I get completely wrong values when I put a break point after the PRINT statements, and

try to look at the variable contents. It looks like it does not think they were initialized.

And about half the time VS crashes ! !

The problem goes away when I make everything real(8) instead.

   program kepler
    implicit none
    real(16) r(3),th(3),x(3),y(3),e,p,kang
   !!!!!!!!!!!!!!!!!!!!!    
    kang=1
    e=0. 
    p=1.0 
    th(1)=.7854Q0
    r(1) =p/( 1.0 - e*cos(th(1)) )
    th(2)=kang/r(1)**2 ! theta dot  
    r(2) =-sin(th(1))/( 1.0 - e*cos(th(1))**2 )
    r(2) =r(2)*p
    x(1)=r(1)*cos(th(1))
    y(1)=r(1)*sin(th(1))
    x(2)=-r(1)*sin(th(1))*th(2)+cos(th(1))*r(2)
    y(2)= r(1)*cos(th(1))*th(2)-sin(th(1))*r(2)
    th(3)=-2.0*r(2)/r(1)**3
    print *,"e,p=",e,p
    print *,"r=",r
    print *,"th=",th
    print *,"x=",x
    print *,"y=",y
    read(*,*)
    end program kepler

Real(16) is part of the standard, right ?

 

 

 


Viewing all articles
Browse latest Browse all 5691

Trending Articles