GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
extreme.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <math.h>
3
4
double
*
Cdhc_extreme
(
double
*
x
,
int
n)
5
{
6
int
i;
7
static
double
y[2];
8
double
min
,
max
, sum1 = 0.;
9
10
min
=
max
=
x
[0];
11
for
(i = 0; i < n; ++i) {
12
sum1 +=
x
[i];
13
if
(
min
>
x
[i])
14
min
=
x
[i];
15
16
if
(
max
<
x
[i])
17
max
=
x
[i];
18
}
19
sum1 /= n;
20
21
y[0] =
max
- sum1;
22
y[1] =
min
- sum1;
23
24
#ifdef NOISY
25
fprintf(stdout,
" TEST3 U(N) =%10.4f U(1) =%10.4f\n"
, y[0], y[1]);
26
#endif
/* NOISY */
27
28
return
y;
29
}
min
#define min(x, y)
Definition:
draw2.c:29
max
#define max(x, y)
Definition:
draw2.c:30
Cdhc_extreme
double * Cdhc_extreme(double *x, int n)
Definition:
extreme.c:4
x
#define x
lib
cdhc
extreme.c
Generated on Sat Dec 21 2024 07:31:21 for GRASS GIS 8 Programmer's Manual by
1.9.1