diff options
Diffstat (limited to 'ACE/apps/JAWS/clients/WebSTONE/src/statistics.c')
-rw-r--r-- | ACE/apps/JAWS/clients/WebSTONE/src/statistics.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/statistics.c b/ACE/apps/JAWS/clients/WebSTONE/src/statistics.c new file mode 100644 index 00000000000..efc82c96e9a --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/statistics.c @@ -0,0 +1,49 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* FUZZ: disable check_for_math_include */ +#include <math.h> +#include <stdlib.h> +#include "sysdep.h" +#include "bench.h" + + +double +mean(const double sum, const int n) +{ + if (n) + { + return(sum / n); + } + else + { + return(0); + } +} + + +double +variance(const double sum, const double sumofsquares, const int n) +{ + double meanofsum; + + meanofsum = mean(sum, n); + + return (mean(sumofsquares,n) - (meanofsum * meanofsum)); +} + + +double +stddev(const double sum, const double sumofsquares, const int n) +{ + return(sqrt(fabs(variance(sum, sumofsquares, n)))); +} |