• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Mystery - fortran

Ludwig795

Junior Member
I have in fortran code - partt of code

Ueta1 = 0.6007 + (2.0*eta*0.86201)
Ueta1 = Ueta1 - (1.70706*3.0*eta*eta)
Ueta1 = Ueat1 + (1.08438*4.0*eta*eta*eta)
write(*,*)'3 eta ',eta,' Ueta1 ',Ueta1

result is NaN (eta is between 0 and 1)

When I try found what is wrong and put


Ueta1 = 0.6007 + (2.0*eta*0.86201)
write(*,*)'1 eta ',eta,' Ueta1 ',Ueta1
Ueta1 = Ueta1 - (1.70706*3.0*eta*eta)
write(*,*)'2 eta ',eta,' Ueta1 ',Ueta1
Ueta1 = Ueat1 + (1.08438*4.0*eta*eta*eta)
write(*,*)'3 eta ',eta,' Ueta1 ',Ueta1

results are OK.

Well, how can write change something?
 
Finally, a case that only the AT Programming Forum User Skillset List can solve! The skills sticky lists the following people familiar with fortran...

Cooler - Reel - CycloWizard - Sassy Rabbit - MovingTarget - cipher00

Maybe drop one of them a PM and see if they can help.
 
Originally posted by: Ludwig795
I have in fortran code - partt of code

Ueta1 = 0.6007 + (2.0*eta*0.86201)
Ueta1 = Ueta1 - (1.70706*3.0*eta*eta)
Ueta1 = Ueat1 + (1.08438*4.0*eta*eta*eta)
write(*,*)'3 eta ',eta,' Ueta1 ',Ueta1

result is NaN (eta is between 0 and 1)

When I try found what is wrong and put


Ueta1 = 0.6007 + (2.0*eta*0.86201)
write(*,*)'1 eta ',eta,' Ueta1 ',Ueta1
Ueta1 = Ueta1 - (1.70706*3.0*eta*eta)
write(*,*)'2 eta ',eta,' Ueta1 ',Ueta1
Ueta1 = Ueat1 + (1.08438*4.0*eta*eta*eta)
write(*,*)'3 eta ',eta,' Ueta1 ',Ueta1

results are OK.

Well, how can write change something?

You have a typo. Ueat1 vs Ueta1. In your second example, you probably did type it right, but copied, pasted and modified here?



Ueta1 = ((0.6007 + (2.0*eta*0.86201) - (1.70706*3.0*eta*eta)) + (1.08438*4.0*eta*eta*eta)

 
Originally posted by: gsellis
Originally posted by: Ludwig795
I have in fortran code - partt of code

Ueta1 = 0.6007 + (2.0*eta*0.86201)
Ueta1 = Ueta1 - (1.70706*3.0*eta*eta)
Ueta1 = Ueat1 + (1.08438*4.0*eta*eta*eta)
write(*,*)'3 eta ',eta,' Ueta1 ',Ueta1

result is NaN (eta is between 0 and 1)

When I try found what is wrong and put


Ueta1 = 0.6007 + (2.0*eta*0.86201)
write(*,*)'1 eta ',eta,' Ueta1 ',Ueta1
Ueta1 = Ueta1 - (1.70706*3.0*eta*eta)
write(*,*)'2 eta ',eta,' Ueta1 ',Ueta1
Ueta1 = Ueat1 + (1.08438*4.0*eta*eta*eta)
write(*,*)'3 eta ',eta,' Ueta1 ',Ueta1

results are OK.

Well, how can write change something?

You have a typo. Ueat1 vs Ueta1. In your second example, you probably did type it right, but copied, pasted and modified here?



Ueta1 = ((0.6007 + (2.0*eta*0.86201) - (1.70706*3.0*eta*eta)) + (1.08438*4.0*eta*eta*eta)

There is another Ueat1 down below too, but does seem odd.

In Fortran, are unintelligible variable names de rigeur, maybe there is a limit on their length?? I was taught never to have numbers in my variable names for readability.

Hmm there is a compilation arg for gnu you might get a dump from this:

-ffpe-trap=invalid,zero,overflow.

 
Thanks for comments.

Yes, I copy and paste this from notepad to linux console in vi editor.

If I write exactly same text/code by typing - everything start work. Well, really strange, can you explain/understand it?
 
control type characters become embedded in the source.
Invisible to the editor but a problem for the compiler.
 
Try TextPad. It lets you see those invisible characters and convert back and forth between Win and Unix formatting. There is also syntax highlighting and other basic functions. Good control over tabs/spaces. Etc.
 
Back
Top