minmax.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #include <stdio.h>
  14. #include <math.h>
  15. int min1(int arg1, int arg2)
  16. {
  17. int res;
  18. if (arg1 <= arg2) {
  19. res = arg1;
  20. }
  21. else {
  22. res = arg2;
  23. }
  24. return res;
  25. }
  26. int max1(
  27. /*
  28. * L. Mitas (University of Illinois),
  29. * I. Kosinovsky, (USA-CERL), and D.Gerdes (USA-CERL)
  30. *
  31. * modified by McCauley in August 1995
  32. * modified by Mitasova in August 1995
  33. *
  34. */
  35. int arg1, int arg2)
  36. {
  37. int res;
  38. if (arg1 >= arg2) {
  39. res = arg1;
  40. }
  41. else {
  42. res = arg2;
  43. }
  44. return res;
  45. }
  46. double amax1(double arg1, double arg2)
  47. {
  48. double res;
  49. if (arg1 >= arg2) {
  50. res = arg1;
  51. }
  52. else {
  53. res = arg2;
  54. }
  55. return res;
  56. }
  57. double amin1(double arg1, double arg2)
  58. {
  59. double res;
  60. if (arg1 <= arg2) {
  61. res = arg1;
  62. }
  63. else {
  64. res = arg2;
  65. }
  66. return res;
  67. }