2 * Copyright (C) 1991,1992 Erik Schoenfelder (schoenfr@ibr.cs.tu-bs.de)
4 * This file is part of NASE A60.
6 * NASE A60 is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * NASE A60 is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with NASE A60; see the file COPYING. If not, write to the Free
18 * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Erik Schoenfelder (schoenfr@ibr.cs.tu-bs.de)
24 * conversion of numerical values.
25 * 'real' to 'integer' and 'integer' to 'real'.
34 #else /* ! __GNUC__ */
37 # endif /* NO_LIMITS_H */
38 #endif /* ! __GNUC__ */
42 * use these values, if not avail ...
46 #define LONG_MAX 2147483647L
50 * problem using -2147483648: if '-' is scanned as unary minus, the
51 * positive number is greater than LONG_MAX ...
53 #define LONG_MIN (-LONG_MAX-1)
59 * conversion of integer value to real value (and vice versa).
62 #define IVAL2RVAL(l) ((double) (l))
64 #define RVAL2IVAL(x) (((x) + 0.5 >= (double) LONG_MAX) \
66 : ((x) - 0.5 <= (double) LONG_MIN) \
68 : ((x) > 0) ? (long) ((x) + 0.5) \
71 #define RVALTRUNC(x) (((x) > (double) LONG_MAX) \
73 : ((x) < (double) LONG_MIN) \
79 #endif /* CONV_H_HOOK */