source: sasview/src/sas/models/c_extension/cephes/const.c @ 50a77df

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 50a77df was 79492222, checked in by krzywon, 10 years ago

Changed the file and folder names to remove all SANS references.

  • Property mode set to 100644
File size: 9.3 KB
Line 
1/*                                                      const.c
2 *
3 *      Globally declared constants
4 *
5 *
6 *
7 * SYNOPSIS:
8 *
9 * extern double nameofconstant;
10 *
11 *
12 *
13 *
14 * DESCRIPTION:
15 *
16 * This file contains a number of mathematical constants and
17 * also some needed size parameters of the computer arithmetic.
18 * The values are supplied as arrays of hexadecimal integers
19 * for IEEE arithmetic; arrays of octal constants for DEC
20 * arithmetic; and in a normal decimal scientific notation for
21 * other machines.  The particular notation used is determined
22 * by a symbol (DEC, IBMPC, or UNK) defined in the include file
23 * mconf.h.
24 *
25 * The default size parameters are as follows.
26 *
27 * For DEC and UNK modes:
28 * MACHEP =  1.38777878078144567553E-17       2**-56
29 * MAXLOG =  8.8029691931113054295988E1       log(2**127)
30 * MINLOG = -8.872283911167299960540E1        log(2**-128)
31 * MAXNUM =  1.701411834604692317316873e38    2**127
32 *
33 * For IEEE arithmetic (IBMPC):
34 * MACHEP =  1.11022302462515654042E-16       2**-53
35 * MAXLOG =  7.09782712893383996843E2         log(2**1024)
36 * MINLOG = -7.08396418532264106224E2         log(2**-1022)
37 * MAXNUM =  1.7976931348623158E308           2**1024
38 *
39 * The global symbols for mathematical constants are
40 * PI     =  3.14159265358979323846           pi
41 * PIO2   =  1.57079632679489661923           pi/2
42 * PIO4   =  7.85398163397448309616E-1        pi/4
43 * SQRT2  =  1.41421356237309504880           sqrt(2)
44 * SQRTH  =  7.07106781186547524401E-1        sqrt(2)/2
45 * LOG2E  =  1.4426950408889634073599         1/log(2)
46 * SQ2OPI =  7.9788456080286535587989E-1      sqrt( 2/pi )
47 * LOGE2  =  6.93147180559945309417E-1        log(2)
48 * LOGSQ2 =  3.46573590279972654709E-1        log(2)/2
49 * THPIO4 =  2.35619449019234492885           3*pi/4
50 * TWOOPI =  6.36619772367581343075535E-1     2/pi
51 *
52 * These lists are subject to change.
53 */
54
55/*                                                      const.c */
56
57/*
58Cephes Math Library Release 2.3:  March, 1995
59Copyright 1984, 1995 by Stephen L. Moshier
60*/
61
62#include "mconf.h"
63
64#ifdef UNK
65#if 1
66double MACHEP =  1.11022302462515654042E-16;   /* 2**-53 */
67#else
68double MACHEP =  1.38777878078144567553E-17;   /* 2**-56 */
69#endif
70double UFLOWTHRESH =  2.22507385850720138309E-308; /* 2**-1022 */
71#ifdef DENORMAL
72double MAXLOG =  7.09782712893383996732E2;     /* log(MAXNUM) */
73/* double MINLOG = -7.44440071921381262314E2; */     /* log(2**-1074) */
74double MINLOG = -7.451332191019412076235E2;     /* log(2**-1075) */
75#else
76double MAXLOG =  7.08396418532264106224E2;     /* log 2**1022 */
77double MINLOG = -7.08396418532264106224E2;     /* log 2**-1022 */
78#endif
79double MAXNUM =  1.79769313486231570815E308;    /* 2**1024*(1-MACHEP) */
80double PI     =  3.14159265358979323846;       /* pi */
81double PIO2   =  1.57079632679489661923;       /* pi/2 */
82double PIO4   =  7.85398163397448309616E-1;    /* pi/4 */
83double SQRT2  =  1.41421356237309504880;       /* sqrt(2) */
84double SQRTH  =  7.07106781186547524401E-1;    /* sqrt(2)/2 */
85double LOG2E  =  1.4426950408889634073599;     /* 1/log(2) */
86double SQ2OPI =  7.9788456080286535587989E-1;  /* sqrt( 2/pi ) */
87double LOGE2  =  6.93147180559945309417E-1;    /* log(2) */
88double LOGSQ2 =  3.46573590279972654709E-1;    /* log(2)/2 */
89double THPIO4 =  2.35619449019234492885;       /* 3*pi/4 */
90double TWOOPI =  6.36619772367581343075535E-1; /* 2/pi */
91#ifdef INFINITIES
92double INFINITY = 1.0/0.0;  /* 99e999; */
93#else
94double INFINITY =  1.79769313486231570815E308;    /* 2**1024*(1-MACHEP) */
95#endif
96#ifdef NANS
97double NAN = 1.0/0.0 - 1.0/0.0;
98#else
99double NAN = 0.0;
100#endif
101#ifdef MINUSZERO
102double NEGZERO = -0.0;
103#else
104double NEGZERO = 0.0;
105#endif
106#endif
107
108#ifdef IBMPC
109                        /* 2**-53 =  1.11022302462515654042E-16 */
110unsigned short MACHEP[4] = {0x0000,0x0000,0x0000,0x3ca0};
111unsigned short UFLOWTHRESH[4] = {0x0000,0x0000,0x0000,0x0010};
112#ifdef DENORMAL
113                        /* log(MAXNUM) =  7.09782712893383996732224E2 */
114unsigned short MAXLOG[4] = {0x39ef,0xfefa,0x2e42,0x4086};
115                        /* log(2**-1074) = - -7.44440071921381262314E2 */
116/*unsigned short MINLOG[4] = {0x71c3,0x446d,0x4385,0xc087};*/
117unsigned short MINLOG[4] = {0x3052,0xd52d,0x4910,0xc087};
118#else
119                        /* log(2**1022) =   7.08396418532264106224E2 */
120unsigned short MAXLOG[4] = {0xbcd2,0xdd7a,0x232b,0x4086};
121                        /* log(2**-1022) = - 7.08396418532264106224E2 */
122unsigned short MINLOG[4] = {0xbcd2,0xdd7a,0x232b,0xc086};
123#endif
124                        /* 2**1024*(1-MACHEP) =  1.7976931348623158E308 */
125unsigned short MAXNUM[4] = {0xffff,0xffff,0xffff,0x7fef};
126unsigned short PI[4]     = {0x2d18,0x5444,0x21fb,0x4009};
127unsigned short PIO2[4]   = {0x2d18,0x5444,0x21fb,0x3ff9};
128unsigned short PIO4[4]   = {0x2d18,0x5444,0x21fb,0x3fe9};
129unsigned short SQRT2[4]  = {0x3bcd,0x667f,0xa09e,0x3ff6};
130unsigned short SQRTH[4]  = {0x3bcd,0x667f,0xa09e,0x3fe6};
131unsigned short LOG2E[4]  = {0x82fe,0x652b,0x1547,0x3ff7};
132unsigned short SQ2OPI[4] = {0x3651,0x33d4,0x8845,0x3fe9};
133unsigned short LOGE2[4]  = {0x39ef,0xfefa,0x2e42,0x3fe6};
134unsigned short LOGSQ2[4] = {0x39ef,0xfefa,0x2e42,0x3fd6};
135unsigned short THPIO4[4] = {0x21d2,0x7f33,0xd97c,0x4002};
136unsigned short TWOOPI[4] = {0xc883,0x6dc9,0x5f30,0x3fe4};
137#ifdef INFINITIES
138unsigned short INFINITY[4] = {0x0000,0x0000,0x0000,0x7ff0};
139#else
140unsigned short INFINITY[4] = {0xffff,0xffff,0xffff,0x7fef};
141#endif
142#ifdef NANS
143unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x7ffc};
144#else
145unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x0000};
146#endif
147#ifdef MINUSZERO
148unsigned short NEGZERO[4] = {0x0000,0x0000,0x0000,0x8000};
149#else
150unsigned short NEGZERO[4] = {0x0000,0x0000,0x0000,0x0000};
151#endif
152#endif
153
154#ifdef MIEEE
155                        /* 2**-53 =  1.11022302462515654042E-16 */
156unsigned short MACHEP[4] = {0x3ca0,0x0000,0x0000,0x0000};
157unsigned short UFLOWTHRESH[4] = {0x0010,0x0000,0x0000,0x0000};
158#ifdef DENORMAL
159                        /* log(2**1024) =   7.09782712893383996843E2 */
160unsigned short MAXLOG[4] = {0x4086,0x2e42,0xfefa,0x39ef};
161                        /* log(2**-1074) = - -7.44440071921381262314E2 */
162/* unsigned short MINLOG[4] = {0xc087,0x4385,0x446d,0x71c3}; */
163unsigned short MINLOG[4] = {0xc087,0x4910,0xd52d,0x3052};
164#else
165                        /* log(2**1022) =  7.08396418532264106224E2 */
166unsigned short MAXLOG[4] = {0x4086,0x232b,0xdd7a,0xbcd2};
167                        /* log(2**-1022) = - 7.08396418532264106224E2 */
168unsigned short MINLOG[4] = {0xc086,0x232b,0xdd7a,0xbcd2};
169#endif
170                        /* 2**1024*(1-MACHEP) =  1.7976931348623158E308 */
171unsigned short MAXNUM[4] = {0x7fef,0xffff,0xffff,0xffff};
172unsigned short PI[4]     = {0x4009,0x21fb,0x5444,0x2d18};
173unsigned short PIO2[4]   = {0x3ff9,0x21fb,0x5444,0x2d18};
174unsigned short PIO4[4]   = {0x3fe9,0x21fb,0x5444,0x2d18};
175unsigned short SQRT2[4]  = {0x3ff6,0xa09e,0x667f,0x3bcd};
176unsigned short SQRTH[4]  = {0x3fe6,0xa09e,0x667f,0x3bcd};
177unsigned short LOG2E[4]  = {0x3ff7,0x1547,0x652b,0x82fe};
178unsigned short SQ2OPI[4] = {0x3fe9,0x8845,0x33d4,0x3651};
179unsigned short LOGE2[4]  = {0x3fe6,0x2e42,0xfefa,0x39ef};
180unsigned short LOGSQ2[4] = {0x3fd6,0x2e42,0xfefa,0x39ef};
181unsigned short THPIO4[4] = {0x4002,0xd97c,0x7f33,0x21d2};
182unsigned short TWOOPI[4] = {0x3fe4,0x5f30,0x6dc9,0xc883};
183#ifdef INFINITIES
184unsigned short INFINITY[4] = {0x7ff0,0x0000,0x0000,0x0000};
185#else
186unsigned short INFINITY[4] = {0x7fef,0xffff,0xffff,0xffff};
187#endif
188#ifdef NANS
189unsigned short NAN[4] = {0x7ff8,0x0000,0x0000,0x0000};
190#else
191unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x0000};
192#endif
193#ifdef MINUSZERO
194unsigned short NEGZERO[4] = {0x8000,0x0000,0x0000,0x0000};
195#else
196unsigned short NEGZERO[4] = {0x0000,0x0000,0x0000,0x0000};
197#endif
198#endif
199
200#ifdef DEC
201                        /* 2**-56 =  1.38777878078144567553E-17 */
202unsigned short MACHEP[4] = {0022200,0000000,0000000,0000000};
203unsigned short UFLOWTHRESH[4] = {0x0080,0x0000,0x0000,0x0000};
204                        /* log 2**127 = 88.029691931113054295988 */
205unsigned short MAXLOG[4] = {041660,007463,0143742,025733,};
206                        /* log 2**-128 = -88.72283911167299960540 */
207unsigned short MINLOG[4] = {0141661,071027,0173721,0147572,};
208                        /* 2**127 = 1.701411834604692317316873e38 */
209unsigned short MAXNUM[4] = {077777,0177777,0177777,0177777,};
210unsigned short PI[4]     = {040511,007732,0121041,064302,};
211unsigned short PIO2[4]   = {040311,007732,0121041,064302,};
212unsigned short PIO4[4]   = {040111,007732,0121041,064302,};
213unsigned short SQRT2[4]  = {040265,002363,031771,0157145,};
214unsigned short SQRTH[4]  = {040065,002363,031771,0157144,};
215unsigned short LOG2E[4]  = {040270,0125073,024534,013761,};
216unsigned short SQ2OPI[4] = {040114,041051,0117241,0131204,};
217unsigned short LOGE2[4]  = {040061,071027,0173721,0147572,};
218unsigned short LOGSQ2[4] = {037661,071027,0173721,0147572,};
219unsigned short THPIO4[4] = {040426,0145743,0174631,007222,};
220unsigned short TWOOPI[4] = {040042,0174603,067116,042025,};
221/* Approximate infinity by MAXNUM.  */
222unsigned short INFINITY[4] = {077777,0177777,0177777,0177777,};
223unsigned short NAN[4] = {0000000,0000000,0000000,0000000};
224#ifdef MINUSZERO
225unsigned short NEGZERO[4] = {0000000,0000000,0000000,0100000};
226#else
227unsigned short NEGZERO[4] = {0000000,0000000,0000000,0000000};
228#endif
229#endif
230
231#ifndef UNK
232extern unsigned short MACHEP[];
233extern unsigned short UFLOWTHRESH[];
234extern unsigned short MAXLOG[];
235extern unsigned short UNDLOG[];
236extern unsigned short MINLOG[];
237extern unsigned short MAXNUM[];
238extern unsigned short PI[];
239extern unsigned short PIO2[];
240extern unsigned short PIO4[];
241extern unsigned short SQRT2[];
242extern unsigned short SQRTH[];
243extern unsigned short LOG2E[];
244extern unsigned short SQ2OPI[];
245extern unsigned short LOGE2[];
246extern unsigned short LOGSQ2[];
247extern unsigned short THPIO4[];
248extern unsigned short TWOOPI[];
249extern unsigned short INFINITY[];
250extern unsigned short NAN[];
251extern unsigned short NEGZERO[];
252#endif
Note: See TracBrowser for help on using the repository browser.