home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJTST200.ZIP / tests / libc / ansi / math / cephes / const.c next >
Encoding:
C/C++ Source or Header  |  1993-12-15  |  8.3 KB  |  236 lines

  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. /*
  58. Cephes Math Library Release 2.0:  April, 1987
  59. Copyright 1984, 1987 by Stephen L. Moshier
  60. Direct inquiries to 30 Frost Street, Cambridge, MA 02140
  61. */
  62.  
  63. #include "mconf.h"
  64. #ifdef __GO32__
  65. #undef IBMPC
  66. #define UNK 1
  67. #endif
  68.  
  69. #ifdef UNK
  70. double MACHEP =  1.38777878078144567553E-17;   /* 2**-56 */
  71. double MAXLOG =  8.8029691931113054295988E1;   /* log(2**127) */
  72. double MINLOG = -8.872283911167299960540E1;    /* log(2**-128) */
  73. double MAXNUM =  1.701411834604692317316873e38; /* 2**127 */
  74. double CPI     =  3.14159265358979323846;       /* pi */
  75. double PIO2   =  1.57079632679489661923;       /* pi/2 */
  76. double PIO4   =  7.85398163397448309616E-1;    /* pi/4 */
  77. double SQRT2  =  1.41421356237309504880;       /* sqrt(2) */
  78. double SQRTH  =  7.07106781186547524401E-1;    /* sqrt(2)/2 */
  79. double LOG2E  =  1.4426950408889634073599;     /* 1/log(2) */
  80. double SQ2OPI =  7.9788456080286535587989E-1;  /* sqrt( 2/pi ) */
  81. double LOGE2  =  6.93147180559945309417E-1;    /* log(2) */
  82. double LOGSQ2 =  3.46573590279972654709E-1;    /* log(2)/2 */
  83. double THPIO4 =  2.35619449019234492885;       /* 3*pi/4 */
  84. double TWOOPI =  6.36619772367581343075535E-1; /* 2/pi */
  85. /* almost 2^16384 */
  86. long double MAXNUML = 1.189731495357231765021263853E4932L;
  87. /* 2^-64 */
  88. long double MACHEPL = 5.42101086242752217003726400434970855712890625E-20L;
  89. /* log( MAXNUML ) */
  90. long double MAXLOGL =  1.1356523406294143949492E4L;
  91. /* log( underflow threshold = 2^(-16382) ) */
  92. long double MINLOGL = -1.1355137111933024058873E4L;
  93. long double LOGE2L  = 6.9314718055994530941723E-1L;
  94. long double LOG2EL  = 1.4426950408889634073599E0L;
  95. long double PIL     = 3.1415926535897932384626L;
  96. long double PIO2L   = 1.5707963267948966192313L;
  97. long double PIO4L   = 7.8539816339744830961566E-1L;
  98. #endif
  99.  
  100. #ifdef IBMPC
  101.             /* 2**-53 =  1.11022302462515654042E-16 */
  102. unsigned short MACHEP[4] = {0x0000,0x0000,0x0000,0x3ca0};
  103.             /* log(2**1024) =   7.09782712893383996843E2 */
  104. unsigned short MAXLOG[4] = {0x39ef,0xfefa,0x2e42,0x4086};
  105.             /* log(2**-1022) = - 7.08396418532264106224E2 */
  106. unsigned short UNDLOG[4] = {0xbcd2,0xdd7a,0x232b,0xc086};
  107.             /* log(2**-1074) = - -7.44440071921381262314E2 */
  108. unsigned short MINLOG[4] = {0x71c3,0x446d,0x4385,0xc087};
  109.             /* 2**1024*(1-MACHEP) =  1.7976931348623158E308 */
  110. unsigned short MAXNUM[4] = {0xffffU,0xffffU,0xffffU,0x7fef};
  111. unsigned short CPI[4]     = {0x2d18,0x5444,0x21fb,0x4009};
  112. unsigned short PIO2[4]   = {0x2d18,0x5444,0x21fb,0x3ff9};
  113. unsigned short PIO4[4]   = {0x2d18,0x5444,0x21fb,0x3fe9};
  114. unsigned short SQRT2[4]  = {0x3bcd,0x667f,0xa09e,0x3ff6};
  115. unsigned short SQRTH[4]  = {0x3bcd,0x667f,0xa09e,0x3fe6};
  116. unsigned short LOG2E[4]  = {0x82fe,0x652b,0x1547,0x3ff7};
  117. unsigned short SQ2OPI[4] = {0x3651,0x33d4,0x8845,0x3fe9};
  118. unsigned short LOGE2[4]  = {0x39ef,0xfefa,0x2e42,0x3fe6};
  119. unsigned short LOGSQ2[4] = {0x39ef,0xfefa,0x2e42,0x3fd6};
  120. unsigned short THPIO4[4] = {0x21d2,0x7f33,0xd97c,0x4002};
  121. unsigned short TWOOPI[4] = {0xc883,0x6dc9,0x5f30,0x3fe4};
  122. unsigned short MAXNUML[] = {0xffffU,0xffffU,0xffffU,0xffffU,0x7ffe};
  123. unsigned short MAXLOGL[] = {0x79ab,0xd1cf,0x17f7,0xb172,0x400c};
  124. unsigned short MINLOGL[] = {0xeb2f,0x1210,0x8c67,0xb16c,0xc00c};
  125. unsigned short MACHEPL[] = {0x0000,0x0000,0x0000,0x8000,0x3fbf};
  126. unsigned short LOGE2L[]  = {0x79ac,0xd1cf,0x17f7,0xb172,0x3ffe};
  127. unsigned short LOG2EL[]  = {0xf0bc,0x5c17,0x3b29,0xb8aa,0x3fff};
  128. unsigned short PIL[]     = {0xc235,0x2168,0xdaa2,0xc90f,0x4000};
  129. unsigned short PIO2L[]   = {0xc235,0x2168,0xdaa2,0xc90f,0x3fff};
  130. unsigned short PIO4L[]   = {0xc235,0x2168,0xdaa2,0xc90f,0x3ffe};
  131. #endif
  132.  
  133. #ifdef MIEEE
  134.             /* 2**-53 =  1.11022302462515654042E-16 */
  135. short MACHEP[4] = {
  136. 0x3ca0,0x0000,0x0000,0x0000
  137. };
  138.             /* log(2**1024) =   7.09782712893383996843E2 */
  139. short MAXLOG[4] = {
  140. 0x4086,0x2e42,0xfefa,0x39ef
  141. };
  142.             /* log(2**-1022) = - 7.08396418532264106224E2 */
  143. short MINLOG[4] = {
  144. 0xc086,0x232b,0xdd7a,0xbcd2
  145. };
  146.             /* 2**1024*(1-MACHEP) =  1.7976931348623158E308 */
  147. short MAXNUM[4] = {
  148. 0x7fef,0xffff,0xffff,0xffff
  149. };
  150. short CPI[4]     = {
  151. 0x4009,0x21fb,0x5444,0x2d18
  152. };
  153. short PIO2[4]   = {
  154. 0x3ff9,0x21fb,0x5444,0x2d18
  155. };
  156. short PIO4[4]   = {
  157. 0x3fe9,0x21fb,0x5444,0x2d18
  158. };
  159. short SQRT2[4]  = {
  160. 0x3ff6,0xa09e,0x667f,0x3bcd
  161. };
  162. short SQRTH[4]  = {
  163. 0x3fe6,0xa09e,0x667f,0x3bcd
  164. };
  165. short LOG2E[4]  = {
  166. 0x3ff7,0x1547,0x652b,0x82fe
  167. };
  168. short SQ2OPI[4] = {
  169. 0x3fe9,0x8845,0x33d4,0x3651
  170. };
  171. short LOGE2[4]  = {
  172. 0x3fe6,0x2e42,0xfefa,0x39ef
  173. };
  174. short LOGSQ2[4] = {
  175. 0x3fd6,0x2e42,0xfefa,0x39ef
  176. };
  177. short THPIO4[4] = {
  178. 0x4002,0xd97c,0x7f33,0x21d2
  179. };
  180. short TWOOPI[4] = {
  181. 0x3fe4,0x5f30,0x6dc9,0xc883
  182. };
  183. long MAXNUML[] = {0x7ffe0000,0xffffffff,0xffffffff};
  184. long MAXLOGL[] = {0x400c0000,0xb17217f7,0xd1cf79ab};
  185. long MINLOGL[] = {0xc00c0000,0xb16c8c67,0x1210eb2f};
  186. long MACHEPL[] = {0x3fbf0000,0x00000000,0x00000000};
  187. long LOGE2L[]  = {0x3ffe0000,0xb17217f7,0xd1cf79ac};
  188. long LOG2EL[]  = {0x3fff0000,0xb8aa3b29,0x5c17f0bc};
  189. long PIL[]     = {0x40000000,0xc90fdaa2,0x2168c235};
  190. long PIO2L[]   = {0x3fff0000,0xc90fdaa2,0x2168c235};
  191. long PIO4L[]   = {0x3ffe0000,0xc90fdaa2,0x2168c235};
  192.  
  193. #endif
  194.  
  195. #ifdef DEC
  196.             /* 2**-56 =  1.38777878078144567553E-17 */
  197. short MACHEP[4] = {0022200,0000000,0000000,0000000};
  198.             /* log 2**127 = 88.029691931113054295988 */
  199. short MAXLOG[4] = {041660,007463,0143742,025733,};
  200.             /* log 2**-128 = -88.72283911167299960540 */
  201. short MINLOG[4] = {0141661,071027,0173721,0147572,};
  202.             /* 2**127 = 1.701411834604692317316873e38 */
  203. short MAXNUM[4] = {077777,0177777,0177777,0177777,};
  204. short CPI[4]     = {040511,007732,0121041,064302,};
  205. short PIO2[4]   = {040311,007732,0121041,064302,};
  206. short PIO4[4]   = {040111,007732,0121041,064302,};
  207. short SQRT2[4]  = {040265,002363,031771,0157145,};
  208. short SQRTH[4]  = {040065,002363,031771,0157144,};
  209. short LOG2E[4]  = {040270,0125073,024534,013761,};
  210. short SQ2OPI[4] = {040114,041051,0117241,0131204,};
  211. short LOGE2[4]  = {040061,071027,0173721,0147572,};
  212. short LOGSQ2[4] = {037661,071027,0173721,0147572,};
  213. short THPIO4[4] = {040426,0145743,0174631,007222,};
  214. short TWOOPI[4] = {040042,0174603,067116,042025,};
  215. #endif
  216. /*
  217. extern short MACHEP[];
  218. extern short MAXLOG[];
  219. extern short UNDLOG[];
  220. extern short MINLOG[];
  221. extern short MAXNUM[];
  222. extern short CPI[];
  223. extern short PIO2[];
  224. extern short PIO4[];
  225. extern short SQRT2[];
  226. extern short SQRTH[];
  227. extern short LOG2E[];
  228. extern short SQ2OPI[];
  229. extern short LOGE2[];
  230. extern short LOGSQ2[];
  231. extern short THPIO4[];
  232. extern short TWOOPI[];
  233. */
  234. static char x[] =
  235. "Cephes Math Library Copyright 1987 by Stephen L. Moshier";
  236.