- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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 ?
Link kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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)
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I could reproduce this with 16.0.0 but not 16.0.2. Please install the current version.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Last week.
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite