1 /* $OpenBSD: mconf.h,v 1.1 2011/05/30 20:23:35 martynas Exp $ */ 2 3 /* 4 * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /* mconf.h 20 * 21 * Common include file for math routines 22 * 23 * 24 * 25 * SYNOPSIS: 26 * 27 * #include "mconf.h" 28 * 29 * 30 * 31 * DESCRIPTION: 32 * 33 * This file contains definitions for error codes that are 34 * passed to the common error handling routine mtherr() 35 * (which see). 36 * 37 * The file also includes a conditional assembly definition 38 * for the type of computer arithmetic (IEEE, DEC, Motorola 39 * IEEE, or UNKnown). 40 * 41 * For Digital Equipment PDP-11 and VAX computers, certain 42 * IBM systems, and others that use numbers with a 56-bit 43 * significand, the symbol DEC should be defined. In this 44 * mode, most floating point constants are given as arrays 45 * of octal integers to eliminate decimal to binary conversion 46 * errors that might be introduced by the compiler. 47 * 48 * For little-endian computers, such as IBM PC, that follow the 49 * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE 50 * Std 754-1985), the symbol IBMPC should be defined. These 51 * numbers have 53-bit significands. In this mode, constants 52 * are provided as arrays of hexadecimal 16 bit integers. 53 * 54 * Big-endian IEEE format is denoted MIEEE. On some RISC 55 * systems such as Sun SPARC, double precision constants 56 * must be stored on 8-byte address boundaries. Since integer 57 * arrays may be aligned differently, the MIEEE configuration 58 * may fail on such machines. 59 * 60 * To accommodate other types of computer arithmetic, all 61 * constants are also provided in a normal decimal radix 62 * which one can hope are correctly converted to a suitable 63 * format by the available C language compiler. To invoke 64 * this mode, define the symbol UNK. 65 * 66 * An important difference among these modes is a predefined 67 * set of machine arithmetic constants for each. The numbers 68 * MACHEP (the machine roundoff error), MAXNUM (largest number 69 * represented), and several other parameters are preset by 70 * the configuration symbol. Check the file const.c to 71 * ensure that these values are correct for your computer. 72 * 73 * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL 74 * may fail on many systems. Verify that they are supposed 75 * to work on your computer. 76 */ 77 78 /* Define if the `long double' type works. */ 79 #define HAVE_LONG_DOUBLE 1 80 81 /* Define as the return type of signal handlers (int or void). */ 82 #define RETSIGTYPE void 83 84 /* Define if you have the ANSI C header files. */ 85 #define STDC_HEADERS 1 86 87 /* Define if your processor stores words with the most significant 88 byte first (like Motorola and SPARC, unlike Intel and VAX). */ 89 /* #undef WORDS_BIGENDIAN */ 90 91 /* Define if floating point words are bigendian. */ 92 /* #undef FLOAT_WORDS_BIGENDIAN */ 93 94 /* The number of bytes in a int. */ 95 #define SIZEOF_INT 4 96 97 /* Define if you have the <string.h> header file. */ 98 #define HAVE_STRING_H 1 99 100 /* Name of package */ 101 #define PACKAGE "cephes" 102 103 /* Version number of package */ 104 #define VERSION "2.7" 105 106 /* Constant definitions for math error conditions 107 */ 108 109 #define DOMAIN 1 /* argument domain error */ 110 #define SING 2 /* argument singularity */ 111 #define OVERFLOW 3 /* overflow range error */ 112 #define UNDERFLOW 4 /* underflow range error */ 113 #define TLOSS 5 /* total loss of precision */ 114 #define PLOSS 6 /* partial loss of precision */ 115 116 #define EDOM 33 117 #define ERANGE 34 118 /* Complex numeral. */ 119 typedef struct 120 { 121 double r; 122 double i; 123 } cmplx; 124 125 #ifdef HAVE_LONG_DOUBLE 126 /* Long double complex numeral. */ 127 typedef struct 128 { 129 long double r; 130 long double i; 131 } cmplxl; 132 #endif 133 134 135 /* Type of computer arithmetic */ 136 137 /* PDP-11, Pro350, VAX: 138 */ 139 /* #define DEC 1 */ 140 141 /* Intel IEEE, low order words come first: 142 */ 143 /* #define IBMPC 1 */ 144 145 /* Motorola IEEE, high order words come first 146 * (Sun 680x0 workstation): 147 */ 148 /* #define MIEEE 1 */ 149 150 /* UNKnown arithmetic, invokes coefficients given in 151 * normal decimal format. Beware of range boundary 152 * problems (MACHEP, MAXLOG, etc. in const.c) and 153 * roundoff problems in pow.c: 154 * (Sun SPARCstation) 155 */ 156 #define UNK 1 157 158 /* If you define UNK, then be sure to set BIGENDIAN properly. */ 159 #ifdef FLOAT_WORDS_BIGENDIAN 160 #define BIGENDIAN 1 161 #else 162 #define BIGENDIAN 0 163 #endif 164 /* Define this `volatile' if your compiler thinks 165 * that floating point arithmetic obeys the associative 166 * and distributive laws. It will defeat some optimizations 167 * (but probably not enough of them). 168 * 169 * #define VOLATILE volatile 170 */ 171 #define VOLATILE 172 173 /* For 12-byte long doubles on an i386, pad a 16-bit short 0 174 * to the end of real constants initialized by integer arrays. 175 * 176 * #define XPD 0, 177 * 178 * Otherwise, the type is 10 bytes long and XPD should be 179 * defined blank (e.g., Microsoft C). 180 * 181 * #define XPD 182 */ 183 #define XPD 0, 184 185 /* Define to support tiny denormal numbers, else undefine. */ 186 #define DENORMAL 1 187 188 /* Define to ask for infinity support, else undefine. */ 189 #define INFINITIES 1 190 191 /* Define to ask for support of numbers that are Not-a-Number, 192 else undefine. This may automatically define INFINITIES in some files. */ 193 #define NANS 1 194 195 /* Define to distinguish between -0.0 and +0.0. */ 196 #define MINUSZERO 1 197 198 /* Define 1 for ANSI C atan2() function 199 See atan.c and clog.c. */ 200 #define ANSIC 1 201 202 /* Get ANSI function prototypes, if you want them. */ 203 #if 1 204 /* #ifdef __STDC__ */ 205 #define ANSIPROT 1 206 int mtherr ( char *, int ); 207 #else 208 int mtherr(); 209 #endif 210 211 /* Variable for error reporting. See mtherr.c. */ 212 extern int merror; 213