Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / apps / JAWS / clients / WebSTONE / src / statistics.c
blobe661605ce5933c1ee2ed48c4a584d52c0d54720d
1 /**************************************************************************
3 * Copyright (C) 1995 Silicon Graphics, Inc.
5 * These coded instructions, statements, and computer programs were
6 * developed by SGI for public use. If any changes are made to this code
7 * please try to get the changes back to the author. Feel free to make
8 * modifications and changes to the code and release it.
10 **************************************************************************/
12 /* FUZZ: disable check_for_math_include */
13 #include <math.h>
14 #include <stdlib.h>
15 #include "sysdep.h"
16 #include "bench.h"
19 double
20 mean(const double sum, const int n)
22 if (n)
24 return(sum / n);
26 else
28 return(0);
33 double
34 variance(const double sum, const double sumofsquares, const int n)
36 double meanofsum;
38 meanofsum = mean(sum, n);
40 return (mean(sumofsquares,n) - (meanofsum * meanofsum));
44 double
45 stddev(const double sum, const double sumofsquares, const int n)
47 return(sqrt(fabs(variance(sum, sumofsquares, n))));