1*b7275c88Smartynas /* $OpenBSD: econst.c,v 1.1 2011/07/02 18:11:01 martynas Exp $ */ 2*b7275c88Smartynas 3*b7275c88Smartynas /* 4*b7275c88Smartynas * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net> 5*b7275c88Smartynas * 6*b7275c88Smartynas * Permission to use, copy, modify, and distribute this software for any 7*b7275c88Smartynas * purpose with or without fee is hereby granted, provided that the above 8*b7275c88Smartynas * copyright notice and this permission notice appear in all copies. 9*b7275c88Smartynas * 10*b7275c88Smartynas * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11*b7275c88Smartynas * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12*b7275c88Smartynas * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13*b7275c88Smartynas * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14*b7275c88Smartynas * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15*b7275c88Smartynas * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16*b7275c88Smartynas * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17*b7275c88Smartynas */ 18*b7275c88Smartynas 19*b7275c88Smartynas /* econst.c */ 20*b7275c88Smartynas /* e type constants used by high precision check routines */ 21*b7275c88Smartynas 22*b7275c88Smartynas #include "ehead.h" 23*b7275c88Smartynas 24*b7275c88Smartynas 25*b7275c88Smartynas #if NE == 10 26*b7275c88Smartynas /* 0.0 */ 27*b7275c88Smartynas unsigned short ezero[NE] = 28*b7275c88Smartynas {0x0000, 0x0000, 0x0000, 0x0000, 29*b7275c88Smartynas 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,}; 30*b7275c88Smartynas 31*b7275c88Smartynas /* 5.0E-1 */ 32*b7275c88Smartynas unsigned short ehalf[NE] = 33*b7275c88Smartynas {0x0000, 0x0000, 0x0000, 0x0000, 34*b7275c88Smartynas 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3ffe,}; 35*b7275c88Smartynas 36*b7275c88Smartynas /* 1.0E0 */ 37*b7275c88Smartynas unsigned short eone[NE] = 38*b7275c88Smartynas {0x0000, 0x0000, 0x0000, 0x0000, 39*b7275c88Smartynas 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,}; 40*b7275c88Smartynas 41*b7275c88Smartynas /* 2.0E0 */ 42*b7275c88Smartynas unsigned short etwo[NE] = 43*b7275c88Smartynas {0x0000, 0x0000, 0x0000, 0x0000, 44*b7275c88Smartynas 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4000,}; 45*b7275c88Smartynas 46*b7275c88Smartynas /* 3.2E1 */ 47*b7275c88Smartynas unsigned short e32[NE] = 48*b7275c88Smartynas {0x0000, 0x0000, 0x0000, 0x0000, 49*b7275c88Smartynas 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4004,}; 50*b7275c88Smartynas 51*b7275c88Smartynas /* 6.93147180559945309417232121458176568075500134360255E-1 */ 52*b7275c88Smartynas unsigned short elog2[NE] = 53*b7275c88Smartynas {0x40f3, 0xf6af, 0x03f2, 0xb398, 54*b7275c88Smartynas 0xc9e3, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,}; 55*b7275c88Smartynas 56*b7275c88Smartynas /* 1.41421356237309504880168872420969807856967187537695E0 */ 57*b7275c88Smartynas unsigned short esqrt2[NE] = 58*b7275c88Smartynas {0x1d6f, 0xbe9f, 0x754a, 0x89b3, 59*b7275c88Smartynas 0x597d, 0x6484, 0174736, 0171463, 0132404, 0x3fff,}; 60*b7275c88Smartynas 61*b7275c88Smartynas /* 3.14159265358979323846264338327950288419716939937511E0 */ 62*b7275c88Smartynas unsigned short epi[NE] = 63*b7275c88Smartynas {0x2902, 0x1cd1, 0x80dc, 0x628b, 64*b7275c88Smartynas 0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,}; 65*b7275c88Smartynas 66*b7275c88Smartynas /* 5.7721566490153286060651209008240243104215933593992E-1 */ 67*b7275c88Smartynas unsigned short eeul[NE] = { 68*b7275c88Smartynas 0xd1be,0xc7a4,0076660,0063743,0111704,0x3ffe,}; 69*b7275c88Smartynas 70*b7275c88Smartynas #else 71*b7275c88Smartynas 72*b7275c88Smartynas /* 0.0 */ 73*b7275c88Smartynas unsigned short ezero[NE] = { 74*b7275c88Smartynas 0, 0000000,0000000,0000000,0000000,0000000,}; 75*b7275c88Smartynas /* 5.0E-1 */ 76*b7275c88Smartynas unsigned short ehalf[NE] = { 77*b7275c88Smartynas 0, 0000000,0000000,0000000,0100000,0x3ffe,}; 78*b7275c88Smartynas /* 1.0E0 */ 79*b7275c88Smartynas unsigned short eone[NE] = { 80*b7275c88Smartynas 0, 0000000,0000000,0000000,0100000,0x3fff,}; 81*b7275c88Smartynas /* 2.0E0 */ 82*b7275c88Smartynas unsigned short etwo[NE] = { 83*b7275c88Smartynas 0, 0000000,0000000,0000000,0100000,0040000,}; 84*b7275c88Smartynas /* 3.2E1 */ 85*b7275c88Smartynas unsigned short e32[NE] = { 86*b7275c88Smartynas 0, 0000000,0000000,0000000,0100000,0040004,}; 87*b7275c88Smartynas /* 6.93147180559945309417232121458176568075500134360255E-1 */ 88*b7275c88Smartynas unsigned short elog2[NE] = { 89*b7275c88Smartynas 0xc9e4,0x79ab,0150717,0013767,0130562,0x3ffe,}; 90*b7275c88Smartynas /* 1.41421356237309504880168872420969807856967187537695E0 */ 91*b7275c88Smartynas unsigned short esqrt2[NE] = { 92*b7275c88Smartynas 0x597e,0x6484,0174736,0171463,0132404,0x3fff,}; 93*b7275c88Smartynas /* 2/sqrt(PI) = 94*b7275c88Smartynas * 1.12837916709551257389615890312154517168810125865800E0 */ 95*b7275c88Smartynas unsigned short eoneopi[NE] = { 96*b7275c88Smartynas 0x71d5,0x688d,0012333,0135202,0110156,0x3fff,}; 97*b7275c88Smartynas /* 3.14159265358979323846264338327950288419716939937511E0 */ 98*b7275c88Smartynas unsigned short epi[NE] = { 99*b7275c88Smartynas 0xc4c6,0xc234,0020550,0155242,0144417,0040000,}; 100*b7275c88Smartynas /* 5.7721566490153286060651209008240243104215933593992E-1 */ 101*b7275c88Smartynas unsigned short eeul[NE] = { 102*b7275c88Smartynas 0xd1be,0xc7a4,0076660,0063743,0111704,0x3ffe,}; 103*b7275c88Smartynas #endif 104*b7275c88Smartynas extern unsigned short ezero[]; 105*b7275c88Smartynas extern unsigned short ehalf[]; 106*b7275c88Smartynas extern unsigned short eone[]; 107*b7275c88Smartynas extern unsigned short etwo[]; 108*b7275c88Smartynas extern unsigned short e32[]; 109*b7275c88Smartynas extern unsigned short elog2[]; 110*b7275c88Smartynas extern unsigned short esqrt2[]; 111*b7275c88Smartynas extern unsigned short eoneopi[]; 112*b7275c88Smartynas extern unsigned short epi[]; 113*b7275c88Smartynas extern unsigned short eeul[]; 114*b7275c88Smartynas 115