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