X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fq.c;h=63794e0069c944f9686cc669587dae54ba02e97d;hb=5ba24931ec3861ca5befcaae1502dd9105639b44;hp=fc9f8684256548e89cde59b87623f6ee75a781db;hpb=10b60d36fcf6cc9532bf397866c5bdc3393246eb;p=swftools.git diff --git a/lib/q.c b/lib/q.c index fc9f868..63794e0 100644 --- a/lib/q.c +++ b/lib/q.c @@ -113,6 +113,36 @@ int mem_get(mem_t*m, void*data, int length) return length; } +// ------------------------------- median ------------------------------------- + +float medianf(float*a, int n) +{ + int i,j,l,m; + float x; + int k=n&1?n/2:n/2-1; + l=0; + m=n-1; + while(l array->num || nr<0) { - printf("error: reference to element %d in array[%d]\n", nr, array->num); + fprintf(stderr, "error: reference to element %d in array[%d]\n", nr, array->num); return 0; } return array->d[nr].name; } void*array_getvalue(array_t*array, int nr) { if(nr > array->num || nr<0) { - printf("error: reference to element %d in array[%d]\n", nr, array->num); + fprintf(stderr, "error: reference to element %d in array[%d]\n", nr, array->num); return 0; } return array->d[nr].data;