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 

unknown floating point exception b8a1

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



Joined: 17 Nov 2011
Posts: 15

PostPosted: Sat Feb 25, 2012 12:33 pm    Post subject: unknown floating point exception b8a1 Reply with quote

Since I am not a good programmer, I spent a couple of hours to figure out, where is this error coming from without any results. Here is the error message: "Floating point co-processir fault at address 00404244 in file at line 364". This line is a function definition.
I load a file in the beginning of my program. The code is working if the loaded file has 1000 Data points but if I load a file with 2000 Data points, I get this error. I declared the arrays and pre-assigned them with the size 4000, so it wouldnt be the problem.
My code is very long I can not post it here.
Please help me if you can
nice Saturday
Miriam
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Feb 25, 2012 12:52 pm    Post subject: Reply with quote

Posting some lines of code near to line 364 may help us to see the problem.
Back to top
View user's profile Send private message AIM Address
Miriam



Joined: 17 Nov 2011
Posts: 15

PostPosted: Sat Feb 25, 2012 1:00 pm    Post subject: Reply with quote

FUNCTION F1(A,B,C)
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
F1=B/(A*C) (LIne 364)
RETURN
END

and here is the call of the function

D1=F1(RAR,ETA2+(H*C2),E(J+1))
D2=F2(RAR,(ETA1+(H*C1)),VZ(J+1),Q,PER,E(J+1))
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Feb 25, 2012 1:17 pm    Post subject: Reply with quote

Make sure that F1 and its arguments are all DOUBLE PRECISION at the point of call.

Make sure that A and C are not very small.

Use CHECKMATE whilst testing.
Back to top
View user's profile Send private message AIM Address
Miriam



Joined: 17 Nov 2011
Posts: 15

PostPosted: Sat Feb 25, 2012 2:45 pm    Post subject: Reply with quote

here is where and how I call F1 :
Code:

  FUNCTION RB(Q,E,VZ,R)
     IMPLICIT DOUBLE PRECISION (A-H,O-Z)
     DOUBLE PRECISION, DIMENSION (4000)::E,VZ,R
      DOUBLE PRECISION ETA1, ETA2,RAR, H, C1, C2
     COMMON/BOB/L,BI,IMAX,RE,REST,REPHI,FM,PR,PSI1,C3,UINF,PER
C
   ETA1=1.0
   ETA2=0.0
C
C
C
          DO 20 J=1,IMAX-1
      H=R(J+1)-R(J)
      RAR=R(J)
C
      IF(RAR.LT.1.0E-06) THEN
       A1=0.0
      ELSE
       A1=F1(RAR,ETA2,E(J))
      END IF
      A2=F2(RAR,ETA1,VZ(J),Q,PER,E(J))
C
      RAR=RAR+H/2.0
      EEE=(E(J)+E(J+1))/2.0
      VVV=(VZ(J)+VZ(J+1))/2.0
C
      B1=F1(RAR,ETA2+(H*A2)/2.0,EEE)
      B2=F2(RAR,(ETA1+(H*A1)/2.0),VVV,Q,PER,EEE)
      C1=F1(RAR,ETA2+(H*B2)/2.0,EEE)
      C2=F2(RAR,(ETA1+(H*B1)/2.0),VVV,Q,PER,EEE)
C
      RAR=RAR+H/2.0
C
      D1=F1(RAR,ETA2+(H*C2),E(J+1))
      D2=F2(RAR,(ETA1+(H*C1)),VZ(J+1),Q,PER,E(J+1))
C
      ETA1=ETA1+(H*(A1+2.0*B1+2.0*C1+D1))/6.0
      ETA2=ETA2+(H*(A2+2.0*B2+2.0*C2+D2))/6.0
C
 20       CONTINUE
C
   RB=ETA1
C
        RETURN
   END


EVery thing is double precision. I dont get it Sad
P.S: A and C are very small, and it should be that way
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 557
Location: UK

PostPosted: Sat Feb 25, 2012 4:20 pm    Post subject: Re: Reply with quote

Miriam wrote:

P.S: A and C are very small, and it should be that way


Hi Miriam,

How small? If the product A*C on the denominator underflows, i.e. it becomes to small to represent you will get an error.

Can you post the values of A and C so we can check? Or you could try re-writing your function as F1=(B/A)/C which might help if B is small.

Also did you try compiling with Checkmate enabled as Paul suggested?
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
Miriam



Joined: 17 Nov 2011
Posts: 15

PostPosted: Sat Feb 25, 2012 5:09 pm    Post subject: Reply with quote

I compiled with Checkmate, but also with Debug and ReleaseNet, no one is really working. I am now so confused about the values of A and C.
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Mon Feb 27, 2012 12:14 pm    Post subject: Reply with quote

Perhaps you can define a minimum divisor and test the product A*C in your function F1 like here:

if (A*C) .lt. 10.D0*tiny(1.D0) --> program stops

Regards - Wilfried
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2184
Location: Sydney

PostPosted: Tue Feb 28, 2012 12:06 am    Post subject: Reply with quote

It appear to me that you should check the values of A*C. You could do this in Function RB by including
Code:

      subroutine check_AC (R,E,IMAX)
!
      real*8 R(*),e(*),   tiny,RAR,EEE
      integer*4 imax,     n_err, j
!
      n_err = 0          ! count of zero A*C
      tiny  = 1.d-10     ! estimate of what is too small for calculation ??
      DO J=1,IMAX-1
         RAR = R(J)
         EEE = E(J)
         if ( abs (RAR*EEE) < tiny) then
            write (*,*) 'small A*C=', RAR*EEE,' at J=',j
            n_err = n_err+1
         end if
         RAR = (R(J)+R(J+1))/2.0
         EEE = (E(J)+E(J+1))/2.0
         if ( abs (RAR*EEE) < tiny) then
            n_err = n_err+1
            write (*,*) 'small A*C=', RAR*EEE,' at J=',j,'.5'
         end if
      end do
      if (n_err > 0) write (*,*) n_err,' too small values of A*C detected'
!
      end


This could indicate how best to improve Function RB to cope with what is assumed to be unusual values in R or E.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General 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