Silverfrost Forums

Welcome to our forums

unknown floating point exception b8a1

25 Feb 2012 11:33 #9692

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

25 Feb 2012 11:52 #9695

Posting some lines of code near to line 364 may help us to see the problem.

25 Feb 2012 12:00 #9696

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))
25 Feb 2012 12:17 #9697

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.

25 Feb 2012 1:45 #9698

here is where and how I call F1 :

  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 😦 P.S: A and C are very small, and it should be that way

25 Feb 2012 3:20 #9701

Quoted from Miriam

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?

25 Feb 2012 4:09 #9702

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.

27 Feb 2012 11:14 #9715

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

if (AC) .lt. 10.D0tiny(1.D0) --> program stops

Regards - Wilfried

27 Feb 2012 11:06 #9727

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

      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.

Please login to reply.