FUNCTION percentile,x,p ; Returns the pth percentile of the array x, which ; is assumed to be sorted in increasing order. ; B. G. Knapp, 1986-12-11 ; 1998-06-09, IDL v. 5 compliance ; 2000-05-01, Change FIX(r) to LONG(r) n = N_ELEMENTS(x)-1 r = n*p*.01 m = LONG(r) f = r MOD 1. RETURN,(1-f)*x[m]+f*x[(m+1)