c==============================GETCF.FOR================================
c
c    Gets the cf from the corresponding indices of TU to TV.
c    Also if forced, it will check for a prefix.  The subroutine 
c    performs the same as the HP-28S in this regard.     /DEE 1-89

      SUBROUTINE GETCF(CF,TIND,TU,TUIND,TV,UNIT,POWER,SH)
      PARAMETER (MAXUNIT=7)
      CHARACTER*423 TU
      CHARACTER*(MAXUNIT) UNIT
      CHARACTER*(MAXUNIT+2) TUNIT
      INTEGER TIND, POWER, SH, PFIXV(16), TUIND(120)
      REAL*8 CF, TV(120)
      CHARACTER*(16) PFIX

      PFIX='EPTGMKHDdcmunpfa'
      DATA PFIXV /18,15,12,9,6,3,2,1,-1,-2,-3,-6,-9,-12,-15,-18/
      CF=1D0

      TUNIT='/' // UNIT
      TUNIT(SH+2:SH+2)='/'
      TIND=INDEX(TU, TUNIT(1:SH+2))
      IF (TIND .EQ. 0) THEN
         TIND=INDEX(PFIX, UNIT(1:1))
         IF (TIND .EQ. 0) THEN
            PRINT *,'1. Unit and possible prefix unrecognized: ',
     +               UNIT(1:SH)
            STOP
         ENDIF
         CF=10D0**PFIXV(TIND)
         TUNIT='/'// UNIT(2:SH)
         TUNIT(SH+1:SH+1)='/'
         TIND=INDEX(TU, TUNIT(1:SH+1))
         IF (TIND .EQ. 0) THEN
            PRINT *,'2. Unrecognized unit: ',UNIT(1:SH)
            STOP
         ENDIF
      ENDIF
      DO 10, K=1,120
        IF (TIND .EQ. TUIND(K)) GOTO 20
 10   CONTINUE
      PRINT *, 'ERROR IN GETCF.FOR'
      STOP
 20   TIND=K
      CF=(CF*TV(TIND))**POWER
      RETURN
      END