| 1 |
/* gsl_mode.h |
| 2 |
* |
| 3 |
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman |
| 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 |
/* Author: B. Gough and G. Jungman */ |
| 21 |
|
| 22 |
#ifndef __GSL_MODE_H__ |
| 23 |
#define __GSL_MODE_H__ |
| 24 |
|
| 25 |
#undef __BEGIN_DECLS |
| 26 |
#undef __END_DECLS |
| 27 |
#ifdef __cplusplus |
| 28 |
# define __BEGIN_DECLS extern "C" { |
| 29 |
# define __END_DECLS } |
| 30 |
#else |
| 31 |
# define __BEGIN_DECLS /* empty */ |
| 32 |
# define __END_DECLS /* empty */ |
| 33 |
#endif |
| 34 |
|
| 35 |
__BEGIN_DECLS |
| 36 |
|
| 37 |
|
| 38 |
/* Some functions can take a mode argument. This |
| 39 |
* is a rough method to do things like control |
| 40 |
* the precision of the algorithm. This mainly |
| 41 |
* occurs in special functions, but we figured |
| 42 |
* it was ok to have a general facility. |
| 43 |
* |
| 44 |
* The mode type is 32-bit field. Most of |
| 45 |
* the fields are currently unused. Users |
| 46 |
* '|' various predefined constants to get |
| 47 |
* a desired mode. |
| 48 |
*/ |
| 49 |
typedef unsigned int gsl_mode_t; |
| 50 |
|
| 51 |
|
| 52 |
/* Here are the predefined constants. |
| 53 |
* Note that the precision constants |
| 54 |
* are special because they are used |
| 55 |
* to index arrays, so do not change |
| 56 |
* them. The precision information is |
| 57 |
* in the low order 3 bits of gsl_mode_t |
| 58 |
* (the third bit is currently unused). |
| 59 |
*/ |
| 60 |
|
| 61 |
/* Note that "0" is double precision, |
| 62 |
* so that you get that by default if |
| 63 |
* you forget a flag. |
| 64 |
*/ |
| 65 |
#define GSL_PREC_DOUBLE 0 |
| 66 |
#define GSL_PREC_SINGLE 1 |
| 67 |
#define GSL_PREC_APPROX 2 |
| 68 |
|
| 69 |
#ifdef HAVE_INLINE |
| 70 |
extern inline unsigned int GSL_MODE_PREC(gsl_mode_t mt); |
| 71 |
|
| 72 |
extern inline unsigned int |
| 73 |
GSL_MODE_PREC(gsl_mode_t mt) |
| 74 |
{ return (mt & (unsigned int)7); } |
| 75 |
#else /* HAVE_INLINE */ |
| 76 |
#define GSL_MODE_PREC(mt) ((mt) & (unsigned int)7) |
| 77 |
#endif /* HAVE_INLINE */ |
| 78 |
|
| 79 |
|
| 80 |
/* Here are some predefined generic modes. |
| 81 |
*/ |
| 82 |
#define GSL_MODE_DEFAULT 0 |
| 83 |
|
| 84 |
|
| 85 |
__END_DECLS |
| 86 |
|
| 87 |
#endif /* __GSL_MODE_H__ */ |