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.
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 )
end program kepler
Real(16) is part of the standard, right ?
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.
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.
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.
Or say atan(1.0)
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.