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