code: private void dcstep() {
  		double sgnd = gp*Math.signum(gx);
  
  		// the new step
  		double stpf;
  
  		if( fp > fx ) {
  			stpf = handleCase1();
  		} else if( sgnd < 0 ) {
  			stpf = handleCase2();
  		} else if( Math.abs(gp) < Math.abs(gx) ) {
  			stpf = handleCase3();
  		} else {
  			stpf = handleCase4();
  		}
  
  		// update the bracket which contains the solution
  		if( fp > fx ) {
  			// found an upper bound
  			sty = stp;
  			fy = fp;
  			gy = gp;
  		} else {
  			// see if its on the other side of the dip
  			if( sgnd < 0 ) {
  				sty = stx;
  				fy = fx;
  				gy = gx;
  			}
  			stx = stp;
  			fx = fp;
  			gx = gp;
  		}
  		
  		stp = stpf;
  		updated = true;
  	}
docs: Computes the new step and updates fx,fy,gx,dy.