Merge branch 'master' of git://git.gag.com/fw/altos
[fw/altos] / ao-tools / lib / mconf.h
1 /*
2  * This file comes from the cephes math library, which was
3  * released under the GPLV2+ license as a part of the Debian labplot
4  * package (I've included the GPLV2 license reference here to make
5  * this clear) - Keith Packard <keithp@keithp.com>
6  *
7  * Cephes Math Library Release 2.0:  April, 1987
8  * Copyright 1984, 1987 by Stephen L. Moshier
9  * Direct inquiries to 30 Frost Street, Cambridge, MA 02140
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; version 2 of the License.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23  */
24 /*                                                      mconf.h
25  *
26  *      Common include file for math routines
27  *
28  *
29  *
30  * SYNOPSIS:
31  *
32  * #include "mconf.h"
33  *
34  *
35  *
36  * DESCRIPTION:
37  *
38  * This file contains definitions for error codes that are
39  * passed to the common error handling routine mtherr()
40  * (which see).
41  *
42  * The file also includes a conditional assembly definition
43  * for the type of computer arithmetic (IEEE, DEC, Motorola
44  * IEEE, or UNKnown).
45  *
46  * For Digital Equipment PDP-11 and VAX computers, certain
47  * IBM systems, and others that use numbers with a 56-bit
48  * significand, the symbol DEC should be defined.  In this
49  * mode, most floating point constants are given as arrays
50  * of octal integers to eliminate decimal to binary conversion
51  * errors that might be introduced by the compiler.
52  *
53  * For little-endian computers, such as IBM PC, that follow the
54  * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE
55  * Std 754-1985), the symbol IBMPC should be defined.  These
56  * numbers have 53-bit significands.  In this mode, constants
57  * are provided as arrays of hexadecimal 16 bit integers.
58  *
59  * Big-endian IEEE format is denoted MIEEE.  On some RISC
60  * systems such as Sun SPARC, double precision constants
61  * must be stored on 8-byte address boundaries.  Since integer
62  * arrays may be aligned differently, the MIEEE configuration
63  * may fail on such machines.
64  *
65  * To accommodate other types of computer arithmetic, all
66  * constants are also provided in a normal decimal radix
67  * which one can hope are correctly converted to a suitable
68  * format by the available C language compiler.  To invoke
69  * this mode, define the symbol UNK.
70  *
71  * An important difference among these modes is a predefined
72  * set of machine arithmetic constants for each.  The numbers
73  * MACHEP (the machine roundoff error), MAXNUM (largest number
74  * represented), and several other parameters are preset by
75  * the configuration symbol.  Check the file const.c to
76  * ensure that these values are correct for your computer.
77  *
78  * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL
79  * may fail on many systems.  Verify that they are supposed
80  * to work on your computer.
81  */
82 \f
83 /*
84 Cephes Math Library Release 2.3:  June, 1995
85 Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
86
87 Adjusted for use with ACE/gr by Evgeny Stambulchik, October 1997
88 */
89
90 #define __GRACE_SOURCE_
91
92 #include "cmath.h"
93
94 /* Type of computer arithmetic */
95 /* In ACE/gr, defined as a compiler directive - no need to define here */
96
97 /* PDP-11, Pro350, VAX:
98  */
99 #if defined(HAVE_DEC_FPU)
100 #  define DEC 1
101 #endif
102
103 /* Intel IEEE, low order words come first:
104  */
105 #if defined(HAVE_LIEEE_FPU)
106 #  define IBMPC 1
107 #endif
108
109 /* Motorola IEEE, high order words come first
110  * (Sun 680x0 workstation):
111  */
112 #if defined(HAVE_BIEEE_FPU)
113 #  define MIEEE 1
114 #endif
115
116 /* UNKnown arithmetic, invokes coefficients given in
117  * normal decimal format.  Beware of range boundary
118  * problems (MACHEP, MAXLOG, etc. in const.c) and
119  * roundoff problems in pow.c:
120  * (Sun SPARCstation)
121  */
122
123 #if (!defined (DEC) && !defined (IBMPC) && !defined (MIEEE))
124 #  define UNK 1
125 #endif
126
127 /* Define this `volatile' if your compiler thinks
128  * that floating point arithmetic obeys the associative
129  * and distributive laws.  It will defeat some optimizations
130  * (but probably not enough of them).
131  *
132  * #define VOLATILE volatile
133  */
134
135 #ifndef VOLATILE
136 #  define VOLATILE
137 #endif
138
139 #ifdef PI
140 #  undef PI
141 #endif
142
143 #ifdef NAN
144 #  undef NAN
145 #endif
146
147 #ifdef INFINITY
148 #  undef INFINITY
149 #endif
150
151 /* Constant definitions for math error conditions
152  */
153
154 #if defined(DOMAIN)
155 #  undef DOMAIN
156 #endif
157 #define DOMAIN          1       /* argument domain error */
158
159 #if defined(SING)
160 #  undef SING
161 #endif
162 #define SING            2       /* argument singularity */
163
164 #if defined(OVERFLOW)
165 #  undef OVERFLOW
166 #endif
167 #define OVERFLOW        3       /* overflow range error */
168
169 #if defined(UNDERFLOW)
170 #  undef UNDERFLOW
171 #endif
172 #define UNDERFLOW       4       /* underflow range error */
173
174 #if defined(TLOSS)
175 #  undef TLOSS
176 #endif
177 #define TLOSS           5       /* total loss of precision */
178
179 #if defined(PLOSS)
180 #  undef PLOSS
181 #endif
182 #define PLOSS           6       /* partial loss of precision */
183
184 #if defined(EDOM)
185 #  undef EDOM
186 #endif
187 #define EDOM            33
188
189 #if defined(ERANGE)
190 #  undef ERANGE
191 #endif
192 #define ERANGE          34
193
194 #if !defined (UNK)
195   /* Define to support tiny denormal numbers, else undefine. */
196 #  define DENORMAL 1
197
198   /* Define to ask for infinity support, else undefine. */
199 #  define INFINITIES 1
200
201   /* Define to ask for support of numbers that are Not-a-Number,
202    else undefine.  This may automatically define INFINITIES in some files. */
203 #  define NANS 1
204
205   /* Define to distinguish between -0.0 and +0.0.  */
206 #  define MINUSZERO 1
207 #endif
208
209 /* Define 1 for ANSI C atan2() function
210    See atan.c and clog.c. */
211 #define ANSIC 1