GRASS Programmer's Manual  6.4.2(2012)
minmax.c
Go to the documentation of this file.
00001 
00002 /*-
00003  * Written by H. Mitasova, L. Mitas, I. Kosinovsky, D. Gerdes Fall 1994
00004  * University of Illinois
00005  * US Army Construction Engineering Research Lab  
00006  * Copyright 1994, H. Mitasova (University of Illinois),
00007  * L. Mitas (University of Illinois),
00008  * I. Kosinovsky, (USA-CERL), and D.Gerdes (USA-CERL)   
00009  *
00010  * modified by McCauley in August 1995
00011  * modified by Mitasova in August 1995  
00012  *
00013  */
00014 
00015 #include <stdio.h>
00016 #include <math.h>
00017 
00018 int min1(int arg1, int arg2)
00019 {
00020     int res;
00021 
00022     if (arg1 <= arg2) {
00023         res = arg1;
00024     }
00025     else {
00026         res = arg2;
00027     }
00028     return res;
00029 }
00030 
00031 
00032 int max1(
00033             /*
00034              * L. Mitas (University of Illinois),
00035              * I. Kosinovsky, (USA-CERL), and D.Gerdes (USA-CERL)   
00036              *
00037              * modified by McCauley in August 1995
00038              * modified by Mitasova in August 1995  
00039              *
00040              */
00041             int arg1, int arg2)
00042 {
00043     int res;
00044 
00045     if (arg1 >= arg2) {
00046         res = arg1;
00047     }
00048     else {
00049         res = arg2;
00050     }
00051     return res;
00052 }
00053 
00054 double amax1(double arg1, double arg2)
00055 {
00056     double res;
00057 
00058     if (arg1 >= arg2) {
00059         res = arg1;
00060     }
00061     else {
00062         res = arg2;
00063     }
00064     return res;
00065 }
00066 
00067 double amin1(double arg1, double arg2)
00068 {
00069     double res;
00070 
00071     if (arg1 <= arg2) {
00072         res = arg1;
00073     }
00074     else {
00075         res = arg2;
00076     }
00077     return res;
00078 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines