/* bs02r.f -- translated by f2c (version 20000817).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
/* Subroutine */ int bs02r_c(real *data, integer *n, real *skew, real *curt)
{
/* System generated locals */
integer i__1;
real r__1;
/* Builtin functions */
double sqrt(doublereal);
/* Local variables */
static real adev, sdev;
static integer j;
static real p, s, ave, var;
/* IF(N.LE.1)PAUSE 'N must be at least 2' */
/* Parameter adjustments */
--data;
/* Function Body */
s = 0.f;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
s += data[j];
/* L11: */
}
ave = s / *n;
adev = 0.f;
var = 0.f;
*skew = 0.f;
*curt = 0.f;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
s = data[j] - ave;
adev += abs(s);
p = s * s;
var += p;
p *= s;
*skew += p;
p *= s;
*curt += p;
/* L12: */
}
adev /= *n;
var /= *n - 1;
sdev = (real)sqrt(var);
if (var == 0.f) {
return 0;
}
/* Computing 3rd power */
r__1 = sdev;
*skew /= *n * (r__1 * (r__1 * r__1));
/* Computing 2nd power */
r__1 = var;
*curt = *curt / (*n * (r__1 * r__1)) - 3.f;
return 0;
} /* bs02r_c */