gsl_sys__minmax.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* sys/minmax.c
  2. *
  3. * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. */
  19. #include "gsl__config.h"
  20. #define GSL_MAX(a,b) ((a) > (b) ? (a) : (b))
  21. #define GSL_MIN(a,b) ((a) < (b) ? (a) : (b))
  22. #ifndef HIDE_INLINE_STATIC
  23. int GSL_MAX_INT (int a, int b);
  24. int GSL_MIN_INT (int a, int b);
  25. double GSL_MAX_DBL (double a, double b);
  26. double GSL_MIN_DBL (double a, double b);
  27. long double GSL_MAX_LDBL (long double a, long double b);
  28. long double GSL_MIN_LDBL (long double a, long double b);
  29. int
  30. GSL_MAX_INT (int a, int b)
  31. {
  32. return GSL_MAX (a, b);
  33. }
  34. int
  35. GSL_MIN_INT (int a, int b)
  36. {
  37. return GSL_MIN (a, b);
  38. }
  39. double
  40. GSL_MAX_DBL (double a, double b)
  41. {
  42. return GSL_MAX (a, b);
  43. }
  44. double
  45. GSL_MIN_DBL (double a, double b)
  46. {
  47. return GSL_MIN (a, b);
  48. }
  49. long double
  50. GSL_MAX_LDBL (long double a, long double b)
  51. {
  52. return GSL_MAX (a, b);
  53. }
  54. long double
  55. GSL_MIN_LDBL (long double a, long double b)
  56. {
  57. return GSL_MIN (a, b);
  58. }
  59. #endif
  60. /* Define some static functions which are always available */
  61. double gsl_max (double a, double b);
  62. double gsl_min (double a, double b);
  63. double gsl_max (double a, double b)
  64. {
  65. return GSL_MAX (a, b);
  66. }
  67. double gsl_min (double a, double b)
  68. {
  69. return GSL_MIN (a, b);
  70. }