| 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 |
|
| 20 |
#include "gsl__config.h" |
| 21 |
|
| 22 |
#define GSL_MAX(a,b) ((a) > (b) ? (a) : (b)) |
| 23 |
#define GSL_MIN(a,b) ((a) < (b) ? (a) : (b)) |
| 24 |
|
| 25 |
#ifndef HIDE_INLINE_STATIC |
| 26 |
int GSL_MAX_INT (int a, int b); |
| 27 |
int GSL_MIN_INT (int a, int b); |
| 28 |
double GSL_MAX_DBL (double a, double b); |
| 29 |
double GSL_MIN_DBL (double a, double b); |
| 30 |
long double GSL_MAX_LDBL (long double a, long double b); |
| 31 |
long double GSL_MIN_LDBL (long double a, long double b); |
| 32 |
|
| 33 |
int |
| 34 |
GSL_MAX_INT (int a, int b) |
| 35 |
{ |
| 36 |
return GSL_MAX (a, b); |
| 37 |
} |
| 38 |
|
| 39 |
int |
| 40 |
GSL_MIN_INT (int a, int b) |
| 41 |
{ |
| 42 |
return GSL_MIN (a, b); |
| 43 |
} |
| 44 |
|
| 45 |
double |
| 46 |
GSL_MAX_DBL (double a, double b) |
| 47 |
{ |
| 48 |
return GSL_MAX (a, b); |
| 49 |
} |
| 50 |
|
| 51 |
double |
| 52 |
GSL_MIN_DBL (double a, double b) |
| 53 |
{ |
| 54 |
return GSL_MIN (a, b); |
| 55 |
} |
| 56 |
|
| 57 |
long double |
| 58 |
GSL_MAX_LDBL (long double a, long double b) |
| 59 |
{ |
| 60 |
return GSL_MAX (a, b); |
| 61 |
} |
| 62 |
|
| 63 |
long double |
| 64 |
GSL_MIN_LDBL (long double a, long double b) |
| 65 |
{ |
| 66 |
return GSL_MIN (a, b); |
| 67 |
} |
| 68 |
#endif |
| 69 |
|
| 70 |
/* Define some static functions which are always available */ |
| 71 |
|
| 72 |
double gsl_max (double a, double b); |
| 73 |
double gsl_min (double a, double b); |
| 74 |
|
| 75 |
double gsl_max (double a, double b) |
| 76 |
{ |
| 77 |
return GSL_MAX (a, b); |
| 78 |
} |
| 79 |
|
| 80 |
double gsl_min (double a, double b) |
| 81 |
{ |
| 82 |
return GSL_MIN (a, b); |
| 83 |
} |
| 84 |
|