      DOUBLE PRECISION FUNCTION FLOP (X)
      IMPLICIT NONE
C
C SYSTEM DEPENDENT FUNCTION:
C   COUNT AND POSSIBLY CHOP EACH FLOATING POINT OPERATION
C   FLP(1) = FLOP COUNTER
C   FLP(2) = # OF PLACES TO BE CHOPPED
C
      DOUBLE PRECISION X
C
      INCLUDE MATLAB$KOM:COM.KOM
C
      INTEGER K
      DOUBLE PRECISION MASK(14), XX, MM
      REAL MAS(2,14)
      LOGICAL LX(2), LM(2)
      EQUIVALENCE (LX(1), XX), (LM(1), MM)
      EQUIVALENCE (MASK(1), MAS(1))
C
      DATA MAS /
     .      Z'FFFFFFFF', Z'FFF0FFFF',
     .      Z'FFFFFFFF', Z'FF00FFFF',
     .      Z'FFFFFFFF', Z'F000FFFF',
     .      Z'FFFFFFFF', Z'0000FFFF',
     .      Z'FFFFFFFF', Z'0000FFF0',
     .      Z'FFFFFFFF', Z'0000FF00',
     .      Z'FFFFFFFF', Z'0000F000',
     .      Z'FFFFFFFF', Z'00000000',
     .      Z'FFF0FFFF', Z'00000000',
     .      Z'FF00FFFF', Z'00000000',
     .      Z'F000FFFF', Z'00000000',
     .      Z'0000FFFF', Z'00000000',
     .      Z'0000FFF0', Z'00000000',
     .      Z'0000FF80', Z'00000000' /
C
C
      FLP(1) = FLP(1)+1
      K = FLP(2)
      FLOP = X
      IF (K.LE.0) RETURN
      FLOP = 0.0D0
      IF (K.GE.15) RETURN
      XX = X
      MM = MASK(K)
      LX(1) = LX(1).AND.LM(1)
      LX(2) = LX(2).AND.LM(2)
      FLOP = XX
C
      RETURN
      END
