GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
minmax.c
Go to the documentation of this file.
1 /*-
2  * Written by H. Mitasova, L. Mitas, I. Kosinovsky, D. Gerdes Fall 1994
3  * University of Illinois
4  * US Army Construction Engineering Research Lab
5  * Copyright 1994, H. Mitasova (University of Illinois),
6  * L. Mitas (University of Illinois),
7  * I. Kosinovsky, (USA-CERL), and D.Gerdes (USA-CERL)
8  *
9  * modified by McCauley in August 1995
10  * modified by Mitasova in August 1995
11  *
12  */
13 
14 #include <stdio.h>
15 #include <math.h>
16 
17 int min1(int arg1, int arg2)
18 {
19  int res;
20 
21  if (arg1 <= arg2) {
22  res = arg1;
23  }
24  else {
25  res = arg2;
26  }
27  return res;
28 }
29 
30 int max1(
31  /*
32  * L. Mitas (University of Illinois),
33  * I. Kosinovsky, (USA-CERL), and D.Gerdes (USA-CERL)
34  *
35  * modified by McCauley in August 1995
36  * modified by Mitasova in August 1995
37  *
38  */
39  int arg1, int arg2)
40 {
41  int res;
42 
43  if (arg1 >= arg2) {
44  res = arg1;
45  }
46  else {
47  res = arg2;
48  }
49  return res;
50 }
51 
52 double amax1(double arg1, double arg2)
53 {
54  double res;
55 
56  if (arg1 >= arg2) {
57  res = arg1;
58  }
59  else {
60  res = arg2;
61  }
62  return res;
63 }
64 
65 double amin1(double arg1, double arg2)
66 {
67  double res;
68 
69  if (arg1 <= arg2) {
70  res = arg1;
71  }
72  else {
73  res = arg2;
74  }
75  return res;
76 }
double amax1(double arg1, double arg2)
Definition: minmax.c:52
int min1(int arg1, int arg2)
Definition: minmax.c:17
int max1(int arg1, int arg2)
Definition: minmax.c:30
double amin1(double arg1, double arg2)
Definition: minmax.c:65