00100	C   PROGRAM TO FIND THE INVERSE ERROR FUNCTION
00110	      FUNCTION ERRINV(L,C)
00120	      DIMENSION Y(7),Y1(14)
00130	      IF (L)  1, 110, 1
00140	C   CALCULATIONS USING THE ERROR
00150	1     Y(1)=0.
00160	      Y(2)=.842700793
00170	      Y(3)=.995322265
00180	      Y(4)=.999977910
00190	      Y(5)=.999999984
00200	      Y(6)=1.
00210	      Y(7)=1.
00220	      IF (C-1.)  10, 20, 20
00230	10    IF (C)  30, 30, 40
00240	20    ERRINV=6.0
00250	      GO TO 210
00260	30    ERRINV=0.
00270	      GO TO 210
00280	40    DO 50 I=1,7
00290	      
00300	      IF (Y(I)-C)  50, 60, 70
00310	50    CONTINUE
00320	60    ERRINV = I - 1
00330	      GO TO 210
00340	70    XC=I-2
00350	      DO 90 K=1,20
00360	      A=ERR(XC)
00370	      TEMP=XC+(C-A)*(.886226925*EXP(XC*XC))
00380	      B=ERR(TEMP)
00390	      Z=C-B
00400	      XC=TEMP
00410	      IF (Z-1.E-10)  100, 90, 90
00420	90    CONTINUE
00430	100   ERRINV=TEMP
00440	      GO TO 210
00450	110   Y1(1)=1.0
00460	      Y1(2)=.157299207E+00
00470	      Y1(3)=.467773497E-02
00480	      Y1(4)=.220904969E-04
00490	      Y1(5)=.154172578E-07
00500	      Y1(6)=.153745978E-11
00510	      Y1(7)=.215197365E-16
00520	      Y1(8)=.418382554E-22
00530	      Y1(9)=.112242970E-28
00540	C      Y1(10)=.413703172E-36
00550	C      Y1(11)=.208848757E-44
00560	C      Y1(12)=.144086612E-53
00570	C      Y1(13)=.135626115E-63
00580	C      Y1(14)=.173955727E-74
00590	      IF (1.-C)  120, 120, 130
00600	C   CALCULATIONS USING THE COMPLEMENTARY FUNCTION
00610	120   ERRINV=0.
00620	      GO TO 210
00630	130   DO 140 I=1,14
00640	      IF (Y1(I)-C)  160, 150, 140
00650	140   CONTINUE
00660	      XC=12.5
00670	      GO TO 170
00680	150   ERRINV = I - 1
00690	      GO TO 210
00700	160   XC=I-2
00710	170   DO 190 K=1,30
00720	      IF (XC)  180, 175, 180
00730	175   A1=1.0
00740	      GO TO 181
00750	180   A1=ERR(-XC)
00760	181   F=XC+(C-A1)*(-0.886226925*EXP(XC*XC))
00770	      IF (F)  183, 182, 183
00780	182   B1=1.
00790	      GO TO 184
00800	183   B1=ERR(-F)
00810	184   XC=F
00820	      Z=ABS((B1-C)/C)
00830	      IF (Z-1.E-10)  200, 190, 190
00840	190   CONTINUE
00850	200   ERRINV=F
00860	210   RETURN
00870	      END

