C
C
C
C
C
C
C
C
C
          SUBROUTINE TRIM(XOUT,YOUT,XBOUND,XOK,YOK)
C
C  IN ORDER TO RETAIN AS MUCH ACCURACY AS POSSIBLE WHEN ONE OF 
C  THE END POINTS IS CLOSE TO THE MACHINE BOUND, WE WILL ALWAYS 
C  CALCULATE THE Y INTERCEPT BY SUBTRACTION FROM THE POINT
C  NEAREST THE XBOUND
C
          BASE = (YOUT-YOK)/(XOUT-XOK)
          DELTA1 = XBOUND-XOUT
          DELTA2 = XBOUND - XOK
          IF (BABS(DELTA1).GT.BABS(DELTA2)) GO TO 1
          YOUT = YOUT + DELTA1*BASE
          GO TO 2
1         YOUT = YOK + DELTA2*BASE
2         XOUT = XBOUND
          RETURN
          END
