forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

invalid floating point operation

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
dltanner



Joined: 04 Apr 2005
Posts: 3

PostPosted: Mon Dec 25, 2006 9:57 pm    Post subject: invalid floating point operation Reply with quote

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.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Dec 26, 2006 12:06 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
dltanner



Joined: 04 Apr 2005
Posts: 3

PostPosted: Tue Dec 26, 2006 3:39 pm    Post subject: invalid floating point operation Reply with quote

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+.

Thanks for your suggestions.
Back to top
View user's profile Send private message
silverfrost
Site Admin


Joined: 29 Nov 2006
Posts: 191
Location: Manchester

PostPosted: Tue Dec 26, 2006 4:44 pm    Post subject: Reply with quote

'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.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Dec 26, 2006 6:20 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group