      FUNCTION FF(M,N)                                                          
CCC       CALCULATION OF FACTRIAL RATIO TERMS
      IMPLICIT REAL*8(A-H,O-Z)                                                  
      L=N-M                                                                     
      LL=N+M                                                                    
      IP=L/2                                                                    
      CR1=IP                                                                    
      CR2=(LL+1)/2                                                              
      KR=MAX0(L,(LL+1)/2)                                                       
      CR3=LL                                                                    
      S1=1                                                                      
      S2=1                                                                      
      S3=1                                                                     
      SM=1                                                                      
      IF(KR.LE.0) GO TO 1                                                       
      DO 20 I=1,KR                                                              
      IF(S1.LE.CR1) SM=SM*S1                                                    
      IF (S1.LE.DFLOAT(L)) SM=SM*2.D0                                           
      IF(S2.LE.CR2) SM=SM*S2                                                    
      IF (S3.LE.CR3) SM=SM/S3                                                   
      S3=S3+1                                                                   
      IF (S3.LE.CR3) SM=SM/S3                                                   
      S1=S1+1                                                                   
      S2=S2+1                                                                   
      S3=S3+1                                                                   
   20 CONTINUE                                                                  
      IF(L.NE.L/2*2) SM=SM/(LL+1)                                               
    1 FF=SM                                                                     
      RETURN                                                                    
       END                                                                      
