Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Another debugging issue - gives wrong values

WSinc
New Contributor I
370 Views

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 ?

 

 

 

0 Kudos
7 Replies
Steven_L_Intel1
Employee
370 Views

No, real(16) is not "part of the standard" in that the standard does not specify particular kind numbers. Furthermore, the standard requires only single and double precision. That said, this program should work ok.

I can reproduce an issue with Visual Studio crashing when one hits the breakpoint. It might be that the debug support for REAL(16) has some issues - I'll investigate further.

0 Kudos
Harry_A_
Beginner
370 Views

Something that looks a little strange to me is that you feel you need the precision of REAL(16) in your calculations, but you are using a value for pi/4 that is rounded at the 4th significant digit.

0 Kudos
WSinc
New Contributor I
370 Views

Not trying to be exact about that, just trying to get approx. 45 degree polar angle.

If I wanted pi/4, I would put the whole thing in to 18 places, then divide it by four.

3.14159265358979323846, etc.

Or say atan(1.0)

0 Kudos
mecej4
Honored Contributor III
370 Views

I tried with VS2013+IFort 16.0.1. I did not notice anything unusual in the debugger, after reaching a breakpoint set on the READ statement. All the variables had reasonable values.

0 Kudos
Steven_L_Intel1
Employee
370 Views

I could reproduce this with 16.0.0 but not 16.0.2. Please install the current version.

0 Kudos
WSinc
New Contributor I
370 Views

OK, when did 16.0.2 come out ?

 

I might already have it on the other PC -- -

 

No big deal, but thought you'd want to be apprised anyway.

0 Kudos
Steven_L_Intel1
Employee
370 Views

Last week.

0 Kudos
Reply