GRASS GIS 7 Programmer's Manual
7.8.5(2020)-exported
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
}
x
#define x
min
#define min(a, b)
Definition:
pngdriver/draw_bitmap.c:19
Cdhc_extreme
double * Cdhc_extreme(double *x, int n)
Definition:
extreme.c:5
max
#define max(a, b)
Definition:
pngdriver/draw_bitmap.c:22
cdhc
extreme.c
Generated on Mon Dec 21 2020 19:35:24 for GRASS GIS 7 Programmer's Manual by
1.8.20