dd=(float)(delta*(1-.9*xl*xl)); if (Math.abs(psuml)<.2) dd *= .5;
dd = (float) (delta * (1f - .9f * xl * xl)); if (Math.abs(psuml) < .2f) dd *= .5f;
  public static int lpc2lsp (final float[] a,                             final int lpcrdr,                             final float[] freq,                             final int nb,                             final float delta)  {    float psuml, psumr, psumm, temp_xr, xl, xr, xm=0;    float temp_psumr;    int i, j, m, flag, k;    float[] Q;     // ptrs for memory allocation    float[] P;    int px;        // ptrs of respective P'(z) & Q'(z)    int qx;    int p;    int q;    float[] pt;    // ptr used for cheb_poly_eval() whether P' or Q'    int roots = 0; // DR 8/2/94: number of roots found    flag = 1;      // program is searching for a root when, 1 else has found one    m = lpcrdr/2;  // order of P'(z) & Q'(z) polynomials    /* Allocate memory space for polynomials */    Q = new float[m+1];    P = new float[m+1];    /* determine P'(z)'s and Q'(z)'s coefficients where    P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */    px = 0;                      /* initialise ptrs       */    qx = 0;    p = px;    q = qx;    P[px++] = 1.0f;    Q[qx++] = 1.0f;    for (i=1; i<=m; i++){      P[px++] = a[i]+a[lpcrdr+1-i]-P[p++];      Q[qx++] = a[i]-a[lpcrdr+1-i]+Q[q++];    }    px = 0;    qx = 0;    for (i=0; i<m; i++){      P[px] = 2*P[px];      Q[qx] = 2*Q[qx];      px++;      qx++;    }    px = 0; /* re-initialise ptrs */    qx = 0;    /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z).    Keep alternating between the two polynomials as each zero is found  */    xr = 0;    /* initialise xr to zero */    xl = 1.0f; /* start at point xl = 1 */    for (j=0; j<lpcrdr; j++){      if (j%2 != 0) /* determines whether P' or Q' is eval. */        pt = Q;      else        pt = P;      psuml = cheb_poly_eva(pt, xl, lpcrdr); /* evals poly. at xl */      flag = 1;      while ((flag == 1) && (xr >= -1.0)) {        float dd;        /* Modified by JMV to provide smaller steps around x=+-1 */        dd=(float)(delta*(1-.9*xl*xl));        if (Math.abs(psuml)<.2)          dd *= .5;        xr = xl - dd;                          /* interval spacing */        psumr = cheb_poly_eva(pt, xr, lpcrdr); /* poly(xl-delta_x) */        temp_psumr = psumr;        temp_xr = xr;        /* if no sign change increment xr and re-evaluate poly(xr). Repeat til        sign change.        if a sign change has occurred the interval is bisected and then        checked again for a sign change which determines in which        interval the zero lies in.        If there is no sign change between poly(xm) and poly(xl) set interval        between xm and xr else set interval between xl and xr and repeat till        root is located within the specified limits */        if ((psumr*psuml)<0.0) {          roots++;          psumm = psuml;          for (k=0; k<=nb; k++){            xm = (xl+xr)/2; /* bisect the interval */            psumm = cheb_poly_eva(pt, xm, lpcrdr);            if (psumm*psuml>0.) {              psuml = psumm;              xl = xm;            }            else {              psumr = psumm;              xr = xm;            }          }          /* once zero is found, reset initial interval to xr */          freq[j] = xm;          xl = xm;          flag = 0; /* reset flag for next search */        }        else {          psuml = temp_psumr;          xl = temp_xr;        }      }    }    return roots;  }