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