GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71933
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
extreme.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <math.h>
3 
4 
5 double *Cdhc_extreme(double *x, int n)
6 {
7  int i;
8  static double y[2];
9  double min, max, sum1 = 0.;
10 
11  min = max = x[0];
12  for (i = 0; i < n; ++i) {
13  sum1 += x[i];
14  if (min > x[i])
15  min = x[i];
16 
17  if (max < x[i])
18  max = x[i];
19  }
20  sum1 /= n;
21 
22  y[0] = max - sum1;
23  y[1] = min - sum1;
24 
25 #ifdef NOISY
26  fprintf(stdout, " TEST3 U(N) =%10.4f U(1) =%10.4f\n", y[0], y[1]);
27 #endif /* NOISY */
28 
29  return y;
30 }
#define min(x, y)
Definition: draw2.c:31
#define x
#define max(x, y)
Definition: draw2.c:32
double * Cdhc_extreme(double *x, int n)
Definition: extreme.c:5