Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fortran 77 Character Limit

Status
Not open for further replies.

womfalcs3

Technical User
Mar 20, 2009
4
I'm trying to input a function that exceeds this limit. I have tried to break it up using various methods, but I keep getting errors from that.

Is there a work-around?

Thank you.
 
I'm writing a function, but when I compile an execute, I get out 0.000000000 as the result when I plug in any value. Even something as high as 1000. The number I need to put in there is around 40.

At 40, the bottom function yields 1.89(10^-5), so that's why I tried a large number. To see if it's due to rounding (Even though when I write the result, I'm allowing a lot of figures right of the decimal.).

Is there anything wrong with the way I input the function? Is it the very small coefficients (Compiler can't read them?)? If so, how would I work around this? I need this function as it's written.

2lp54x.jpg


Later on, I'm inputting, "muair(40.0)". That value gives me 0.

Thanks.
 
Post he relevant source code in the text form - not a picture.
 
Easiest way to debug these is to split up the formula and print each stage
Code:
muwater(T) = 3.6287E-19 * T **6
muwater(T) = muwater(T)- 3.576E-16 * T ** 5
...

The more efficient way of coding
Code:
aaa = a4*T**4 + a3*T**3 + a2*T**2 + a1*T + a0
is
Code:
aaa = ((((a4 * T) + a3) * T + a2) * T + a1) * T + a0
 
Try double precision variables. You have no chances to get the right answer with ~7 digits precision single floating point.
It's not a compiler problem. It's an ordinar case of floating point calculation problems...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top