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>
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
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.
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.
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.
27 * Common include file for math routines
39 * This file contains definitions for error codes that are
40 * passed to the common error handling routine mtherr()
43 * The file also includes a conditional assembly definition
44 * for the type of computer arithmetic (IEEE, DEC, Motorola
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.
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.
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.
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.
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.
79 * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL
80 * may fail on many systems. Verify that they are supposed
81 * to work on your computer.
85 Cephes Math Library Release 2.3: June, 1995
86 Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
88 Adjusted for use with ACE/gr by Evgeny Stambulchik, October 1997
91 #define __GRACE_SOURCE_
95 /* Type of computer arithmetic */
96 /* In ACE/gr, defined as a compiler directive - no need to define here */
98 /* PDP-11, Pro350, VAX:
100 #if defined(HAVE_DEC_FPU)
104 /* Intel IEEE, low order words come first:
106 #if defined(HAVE_LIEEE_FPU)
110 /* Motorola IEEE, high order words come first
111 * (Sun 680x0 workstation):
113 #if defined(HAVE_BIEEE_FPU)
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:
124 #if (!defined (DEC) && !defined (IBMPC) && !defined (MIEEE))
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).
133 * #define VOLATILE volatile
152 /* Constant definitions for math error conditions
158 #define DOMAIN 1 /* argument domain error */
163 #define SING 2 /* argument singularity */
165 #if defined(OVERFLOW)
168 #define OVERFLOW 3 /* overflow range error */
170 #if defined(UNDERFLOW)
173 #define UNDERFLOW 4 /* underflow range error */
178 #define TLOSS 5 /* total loss of precision */
183 #define PLOSS 6 /* partial loss of precision */
196 /* Define to support tiny denormal numbers, else undefine. */
199 /* Define to ask for infinity support, else undefine. */
200 # define INFINITIES 1
202 /* Define to ask for support of numbers that are Not-a-Number,
203 else undefine. This may automatically define INFINITIES in some files. */
206 /* Define to distinguish between -0.0 and +0.0. */
210 /* Define 1 for ANSI C atan2() function
211 See atan.c and clog.c. */