diff options
Diffstat (limited to 'baseline/source/fmref/wcclibm.c')
| -rw-r--r-- | baseline/source/fmref/wcclibm.c | 522 |
1 files changed, 0 insertions, 522 deletions
diff --git a/baseline/source/fmref/wcclibm.c b/baseline/source/fmref/wcclibm.c deleted file mode 100644 index 39b8cbe..0000000 --- a/baseline/source/fmref/wcclibm.c +++ /dev/null | |||
| @@ -1,522 +0,0 @@ | |||
| 1 | #include "math_private.h" | ||
| 2 | #include "wcclibm.h" | ||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | /* e_rem_pio2f.c -- float version of e_rem_pio2.c | ||
| 7 | * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. | ||
| 8 | */ | ||
| 9 | |||
| 10 | /* | ||
| 11 | * ==================================================== | ||
| 12 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | ||
| 13 | * | ||
| 14 | * Developed at SunPro, a Sun Microsystems, Inc. business. | ||
| 15 | * Permission to use, copy, modify, and distribute this | ||
| 16 | * software is freely granted, provided that this notice | ||
| 17 | * is preserved. | ||
| 18 | * ==================================================== | ||
| 19 | */ | ||
| 20 | |||
| 21 | #if defined(LIBM_SCCS) && !defined(lint) | ||
| 22 | static char rcsid[] = "$NetBSD: e_rem_pio2f.c,v 1.5 1995/05/10 20:46:03 jtc Exp $"; | ||
| 23 | #endif | ||
| 24 | |||
| 25 | /* __ieee754_rem_pio2f(x,y) | ||
| 26 | * | ||
| 27 | * return the remainder of x rem pi/2 in y[0]+y[1] | ||
| 28 | * use __kernel_rem_pio2f() | ||
| 29 | */ | ||
| 30 | |||
| 31 | /* This array is like the one in e_rem_pio2.c, but the numbers are | ||
| 32 | single precision and the last 8 bits are forced to 0. */ | ||
| 33 | #ifdef __STDC__ | ||
| 34 | static const int32_t fmref_npio2_hw[] = { | ||
| 35 | #else | ||
| 36 | static int32_t fmref_npio2_hw[] = { | ||
| 37 | #endif | ||
| 38 | 0x3fc90f00, 0x40490f00, 0x4096cb00, 0x40c90f00, 0x40fb5300, 0x4116cb00, | ||
| 39 | 0x412fed00, 0x41490f00, 0x41623100, 0x417b5300, 0x418a3a00, 0x4196cb00, | ||
| 40 | 0x41a35c00, 0x41afed00, 0x41bc7e00, 0x41c90f00, 0x41d5a000, 0x41e23100, | ||
| 41 | 0x41eec200, 0x41fb5300, 0x4203f200, 0x420a3a00, 0x42108300, 0x4216cb00, | ||
| 42 | 0x421d1400, 0x42235c00, 0x4229a500, 0x422fed00, 0x42363600, 0x423c7e00, | ||
| 43 | 0x4242c700, 0x42490f00 | ||
| 44 | }; | ||
| 45 | |||
| 46 | /* | ||
| 47 | * invpio2: 24 bits of 2/pi | ||
| 48 | * pio2_1: first 17 bit of pi/2 | ||
| 49 | * pio2_1t: pi/2 - pio2_1 | ||
| 50 | * pio2_2: second 17 bit of pi/2 | ||
| 51 | * pio2_2t: pi/2 - (pio2_1+pio2_2) | ||
| 52 | * pio2_3: third 17 bit of pi/2 | ||
| 53 | * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) | ||
| 54 | */ | ||
| 55 | |||
| 56 | #ifdef __STDC__ | ||
| 57 | static const float | ||
| 58 | #else | ||
| 59 | static float | ||
| 60 | #endif | ||
| 61 | /* zero = 0.0000000000e+00f, /\* 0x00000000 *\/ */ | ||
| 62 | /* half = 5.0000000000e-01f, /\* 0x3f000000 *\/ */ | ||
| 63 | /* two8 = 2.5600000000e+02f, /\* 0x43800000 *\/ */ | ||
| 64 | fmref_invpio2 = 6.3661980629e-01f, /* 0x3f22f984 */ | ||
| 65 | fmref_pio2_1 = 1.5707855225e+00f, /* 0x3fc90f80 */ | ||
| 66 | fmref_pio2_1t = 1.0804334124e-05f, /* 0x37354443 */ | ||
| 67 | fmref_pio2_2 = 1.0804273188e-05f, /* 0x37354400 */ | ||
| 68 | fmref_pio2_2t = 6.0770999344e-11f, /* 0x2e85a308 */ | ||
| 69 | fmref_pio2_3 = 6.0770943833e-11f, /* 0x2e85a300 */ | ||
| 70 | fmref_pio2_3t = 6.1232342629e-17f; /* 0x248d3132 */ | ||
| 71 | |||
| 72 | #ifdef __STDC__ | ||
| 73 | int32_t fmref___ieee754_rem_pio2f(float x, float *y) | ||
| 74 | #else | ||
| 75 | int32_t fmref___ieee754_rem_pio2f(x,y) | ||
| 76 | float x,y[]; | ||
| 77 | #endif | ||
| 78 | { | ||
| 79 | float z,w,t,r,fn; | ||
| 80 | int32_t i,j,n,ix,hx; | ||
| 81 | |||
| 82 | GET_FLOAT_WORD(hx,x); | ||
| 83 | ix = hx&0x7fffffff; | ||
| 84 | if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ | ||
| 85 | {y[0] = x; y[1] = 0; return 0;} | ||
| 86 | if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ | ||
| 87 | if(hx>0) { | ||
| 88 | z = x - fmref_pio2_1; | ||
| 89 | if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ | ||
| 90 | y[0] = z - fmref_pio2_1t; | ||
| 91 | y[1] = (z-y[0])-fmref_pio2_1t; | ||
| 92 | } else { /* near pi/2, use 24+24+24 bit pi */ | ||
| 93 | z -= fmref_pio2_2; | ||
| 94 | y[0] = z - fmref_pio2_2t; | ||
| 95 | y[1] = (z-y[0])-fmref_pio2_2t; | ||
| 96 | } | ||
| 97 | return 1; | ||
| 98 | } else { /* negative x */ | ||
| 99 | z = x + fmref_pio2_1; | ||
| 100 | if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ | ||
| 101 | y[0] = z + fmref_pio2_1t; | ||
| 102 | y[1] = (z-y[0])+fmref_pio2_1t; | ||
| 103 | } else { /* near pi/2, use 24+24+24 bit pi */ | ||
| 104 | z += fmref_pio2_2; | ||
| 105 | y[0] = z + fmref_pio2_2t; | ||
| 106 | y[1] = (z-y[0])+fmref_pio2_2t; | ||
| 107 | } | ||
| 108 | return -1; | ||
| 109 | } | ||
| 110 | } | ||
| 111 | if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */ | ||
| 112 | t = fabsf(x); | ||
| 113 | n = (int32_t) (t*fmref_invpio2+fmref_half); | ||
| 114 | fn = (float)n; | ||
| 115 | r = t-fn*fmref_pio2_1; | ||
| 116 | w = fn*fmref_pio2_1t; /* 1st round good to 40 bit */ | ||
| 117 | if(n<32&&(int32_t)(ix&0xffffff00)!=fmref_npio2_hw[n-1]) { | ||
| 118 | y[0] = r-w; /* quick check no cancellation */ | ||
| 119 | } else { | ||
| 120 | u_int32_t high; | ||
| 121 | j = ix>>23; | ||
| 122 | y[0] = r-w; | ||
| 123 | GET_FLOAT_WORD(high,y[0]); | ||
| 124 | i = j-((high>>23)&0xff); | ||
| 125 | if(i>8) { /* 2nd iteration needed, good to 57 */ | ||
| 126 | t = r; | ||
| 127 | w = fn*fmref_pio2_2; | ||
| 128 | r = t-w; | ||
| 129 | w = fn*fmref_pio2_2t-((t-r)-w); | ||
| 130 | y[0] = r-w; | ||
| 131 | GET_FLOAT_WORD(high,y[0]); | ||
| 132 | i = j-((high>>23)&0xff); | ||
| 133 | if(i>25) { /* 3rd iteration need, 74 bits acc */ | ||
| 134 | t = r; /* will cover all possible cases */ | ||
| 135 | w = fn*fmref_pio2_3; | ||
| 136 | r = t-w; | ||
| 137 | w = fn*fmref_pio2_3t-((t-r)-w); | ||
| 138 | y[0] = r-w; | ||
| 139 | } | ||
| 140 | } | ||
| 141 | } | ||
| 142 | y[1] = (r-y[0])-w; | ||
| 143 | if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} | ||
| 144 | else return n; | ||
| 145 | } | ||
| 146 | /* | ||
| 147 | * all other (large) arguments | ||
| 148 | */ | ||
| 149 | if(ix>=0x7f800000) { /* x is inf or NaN */ | ||
| 150 | y[0]=y[1]=x-x; return 0; | ||
| 151 | } | ||
| 152 | |||
| 153 | y[0]=y[1]=x-x; /* dummy initialization */ | ||
| 154 | return 0; /* doesn't happen for our input */ | ||
| 155 | } | ||
| 156 | |||
| 157 | /* k_cosf.c -- float version of k_cos.c | ||
| 158 | * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. | ||
| 159 | */ | ||
| 160 | |||
| 161 | /* | ||
| 162 | * ==================================================== | ||
| 163 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | ||
| 164 | * | ||
| 165 | * Developed at SunPro, a Sun Microsystems, Inc. business. | ||
| 166 | * Permission to use, copy, modify, and distribute this | ||
| 167 | * software is freely granted, provided that this notice | ||
| 168 | * is preserved. | ||
| 169 | * ==================================================== | ||
| 170 | */ | ||
| 171 | |||
| 172 | #if defined(LIBM_SCCS) && !defined(lint) | ||
| 173 | static char rcsid[] = "$NetBSD: k_cosf.c,v 1.4 1995/05/10 20:46:23 jtc Exp $"; | ||
| 174 | #endif | ||
| 175 | |||
| 176 | |||
| 177 | #ifdef __STDC__ | ||
| 178 | static const float | ||
| 179 | #else | ||
| 180 | static float | ||
| 181 | #endif | ||
| 182 | /* one = 1.0000000000e+00, /\* 0x3f800000 *\/ */ | ||
| 183 | fmref_C1 = 4.1666667908e-02f, /* 0x3d2aaaab */ | ||
| 184 | fmref_C2 = -1.3888889225e-03f, /* 0xbab60b61 */ | ||
| 185 | fmref_C3 = 2.4801587642e-05f, /* 0x37d00d01 */ | ||
| 186 | fmref_C4 = -2.7557314297e-07f, /* 0xb493f27c */ | ||
| 187 | fmref_C5 = 2.0875723372e-09f, /* 0x310f74f6 */ | ||
| 188 | fmref_C6 = -1.1359647598e-11f; /* 0xad47d74e */ | ||
| 189 | |||
| 190 | #ifdef __STDC__ | ||
| 191 | float fmref___kernel_cosf(float x, float y) | ||
| 192 | #else | ||
| 193 | float fmref___kernel_cosf(x, y) | ||
| 194 | float x,y; | ||
| 195 | #endif | ||
| 196 | { | ||
| 197 | float a,hz,z,r,qx; | ||
| 198 | int32_t ix; | ||
| 199 | GET_FLOAT_WORD(ix,x); | ||
| 200 | ix &= 0x7fffffff; /* ix = |x|'s high word*/ | ||
| 201 | if(ix<0x32000000) { /* if x < 2**27 */ | ||
| 202 | if(((int)x)==0) return fmref_one; /* generate inexact */ | ||
| 203 | } | ||
