forums.silverfrost.com
Welcome to the Silverfrost forums

Author Message
dltanner

Joined: 04 Apr 2005
Posts: 3

Posted: Mon Dec 25, 2006 9:57 pm    Post subject: invalid floating point operation

I get 'invalid floating point operation' with the following code:

 Code: DO 45 I=1,NC         if(x(i) .lt. 1.d-10)goto 45       XIBL= X(I)*HBARL(I)       HL = HL + X(I)*HBARL(I)      45 CONTINUE

error on 2nd line (got error on 3rd line before 2nd line added.
I=1
x(1) either 0 or 1e-5
I am using:
IMPLICIT REAL*8(A-H.O-Z) and
ZEROISE

Any suggestions?

Thanks.
PaulLaidler

Joined: 21 Feb 2005
Posts: 6004
Location: Salford, UK

 Posted: Tue Dec 26, 2006 12:06 pm    Post subject: What are X and HBARL? If either of these are external functions the compiler will assume that they are functions returning REAL*8, because of your IMPLICIT REAL*8. At a guess HBARL might be a function returning a REAL*4 in which case you could get this error at runtime.
dltanner

Joined: 04 Apr 2005
Posts: 3

Posted: Tue Dec 26, 2006 3:39 pm    Post subject: invalid floating point operation

Hbarl(i) is dimension 50, a calling parameter to Subroutine HLBAR of IMPLICIT REAL*8.

 Code: 40 CALL HLBAR(T,X,HBARL)       DO 45 I=1,NC         if(x(i) .lt. 1.d-10)goto 45       XIBL= X(I)*HBARL(I)       HL = HL + X(I)*HBARL(I)

There are many subroutines with IMPLICIT REAL*8. Should I take the time to declare every variable in every subprogram? Previously, I was using FTN77 and got 'floating point stack overflow' in a different subroutine with REAL*8 variables that should not have caused a problem.

This is legacy FTN77 code from a VAX with all the extensions. I never had a problem with this code when I compiled it on Microsoft Powerstation under WFWG3.11, but, of course, I couldn't use Clearwin+.

silverfrost

Joined: 29 Nov 2006
Posts: 167
Location: Manchester

 Posted: Tue Dec 26, 2006 4:44 pm    Post subject: 'floating point stack overflow' is almost certainly a bug in FTN77. Have you run your code with any checking options? 'invalid floating point operation' quite often means unset variable.
PaulLaidler

Joined: 21 Feb 2005
Posts: 6004
Location: Salford, UK

 Posted: Tue Dec 26, 2006 6:20 pm    Post subject: I still suspect that something is not declared correctly. If you cannot find the mismatch then try using IMPLICIT NONE and declare everything explicitly. This is the recommended modern way to write FORTRAN code.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT + 1 Hour Page 1 of 1