/* limvds.f -- translated by f2c (version of 3 February 1990  3:36:42).
   You must link the resulting object file with the libraries:
	-lF77 -lI77 -lm -lc   (in that order)
*/

#include "f2c.h"

/*<       subroutine limvds(vnew,vold) >*/
/* Subroutine */ int limvds_(vnew, vold)
doublereal *vnew, *vold;
{
    /* System generated locals */
    doublereal d_1, d_2;

/*<       implicit double precision (a-h,o-z) >*/

/*     this routine limits the per-iteration change of fet vds. */

/*<       if (vold.lt.3.5d0) go to 200 >*/
    if (*vold < 3.5) {
	goto L200;
    }

/*<       if (vnew.le.vold) go to 100 >*/
    if (*vnew <= *vold) {
	goto L100;
    }
/*<       vnew=dmin1(vnew,3.0d0*vold+2.0d0) >*/
/* Computing MAX */
    d_1 = *vnew, d_2 = *vold * 3. + 2.;
    *vnew = min(d_2,d_1);
/*<       go to 500 >*/
    goto L500;
/*<   100 if (vnew.lt.3.5d0) vnew=dmax1(vnew,2.0d0) >*/
L100:
    if (*vnew < 3.5) {
	*vnew = max(*vnew,2.);
    }
/*<       go to 500 >*/
    goto L500;

/*<   200 if (vnew.le.vold) go to 300 >*/
L200:
    if (*vnew <= *vold) {
	goto L300;
    }
/*<       vnew=dmin1(vnew,4.0d0) >*/
    *vnew = min(*vnew,4.);
/*<       go to 500 >*/
    goto L500;
/*<   300 vnew=dmax1(vnew,-0.5d0) >*/
L300:
    *vnew = max(*vnew,-.5);

/*<   500 return >*/
L500:
    return 0;
/*<       end >*/
} /* limvds_ */

