mconf.h
Go to the documentation of this file.
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  * The file includes a conditional assembly definition for the type of
16  * computer arithmetic (IEEE, Motorola IEEE, or UNKnown).
17  *
18  * For little-endian computers, such as IBM PC, that follow the
19  * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE
20  * Std 754-1985), the symbol IBMPC should be defined. These
21  * numbers have 53-bit significands. In this mode, constants
22  * are provided as arrays of hexadecimal 16 bit integers.
23  *
24  * Big-endian IEEE format is denoted MIEEE. On some RISC
25  * systems such as Sun SPARC, double precision constants
26  * must be stored on 8-byte address boundaries. Since integer
27  * arrays may be aligned differently, the MIEEE configuration
28  * may fail on such machines.
29  *
30  * To accommodate other types of computer arithmetic, all
31  * constants are also provided in a normal decimal radix
32  * which one can hope are correctly converted to a suitable
33  * format by the available C language compiler. To invoke
34  * this mode, define the symbol UNK.
35  *
36  * An important difference among these modes is a predefined
37  * set of machine arithmetic constants for each. The numbers
38  * MACHEP (the machine roundoff error), MAXNUM (largest number
39  * represented), and several other parameters are preset by
40  * the configuration symbol. Check the file const.c to
41  * ensure that these values are correct for your computer.
42  *
43  * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL
44  * may fail on many systems. Verify that they are supposed
45  * to work on your computer.
46  */
47 
48 /*
49  * Cephes Math Library Release 2.3: June, 1995
50  * Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
51  */
52 
53 #ifndef CEPHES_MCONF_H
54 #define CEPHES_MCONF_H
55 
56 #include <math.h>
57 #include <stdlib.h>
58 
59 #include "cephes.h"
60 #include "polevl.h"
61 #include "sf_error.h"
62 
63 #define MAXITER 500
64 #define EDOM 33
65 #define ERANGE 34
66 
67 /* Type of computer arithmetic */
68 
69 /* UNKnown arithmetic, invokes coefficients given in
70  * normal decimal format. Beware of range boundary
71  * problems (MACHEP, MAXLOG, etc. in const.c) and
72  * roundoff problems in pow.c:
73  * (Sun SPARCstation)
74  */
75 
76 /* SciPy note: by defining UNK, we prevent the compiler from
77  * casting integers to floating point numbers. If the Endianness
78  * is detected incorrectly, this causes problems on some platforms.
79  */
80 #define UNK 1
81 
82 /* Define to support tiny denormal numbers, else undefine. */
83 #define DENORMAL 1
84 
85 #define gamma Gamma
86 
87 /*
88  * Enable loop unrolling on GCC and use faster isnan et al.
89  */
90 #if !defined(__clang__) && defined(__GNUC__) && defined(__GNUC_MINOR__)
91 #if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
92 #pragma GCC optimize("unroll-loops")
93 #define cephes_isnan(x) __builtin_isnan(x)
94 #define cephes_isinf(x) __builtin_isinf(x)
95 #define cephes_isfinite(x) __builtin_isfinite(x)
96 #endif
97 #endif
98 #ifndef cephes_isnan
99 #define cephes_isnan(x) isnan(x)
100 #define cephes_isinf(x) isinf(x)
101 #define cephes_isfinite(x) isfinite(x)
102 #endif
103 
104 /* M_PI et al. are not defined in math.h in C99, even with _USE_MATH_DEFINES */
105 #if !defined(M_PI)
106 #define M_PI 3.14159265358979323846
107 #endif
108 #ifndef M_PI_2
109 #define M_PI_2 1.57079632679489661923 /* pi/2 */
110 #define M_1_PI 0.31830988618379067154 /* 1/pi */
111 #define M_2_PI 0.63661977236758134308 /* 2/pi */
112 #define M_E 2.71828182845904523536
113 #define M_LOG2E 1.44269504088896340736
114 #define M_LOG10E 0.434294481903251827651
115 #define M_LN2 0.693147180559945309417
116 #define M_LN10 2.30258509299404568402
117 #define M_PI 3.14159265358979323846
118 #define M_PI_2 1.57079632679489661923
119 #define M_PI_4 0.785398163397448309616
120 #define M_1_PI 0.318309886183790671538
121 #define M_2_PI 0.636619772367581343076
122 #define M_2_SQRTPI 1.12837916709551257390
123 #define M_SQRT2 1.41421356237309504880
124 #define M_SQRT1_2 0.707106781186547524401
125 #endif
126 
127 /* Constants needed that are not available in the C standard library */
128 #define SCIPY_EULER 0.577215664901532860606512090082402431 /* Euler constant */
129 #define SCIPY_El 2.718281828459045235360287471352662498L /* e as long double */
130 
131 #endif /* CEPHES_MCONF_H */
cephes.h
sf_error.h
polevl.h


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:33:46