xref: /titanic_44/usr/src/lib/libmvec/common/__vpowf.c (revision 25c28e83beb90e7c80452a7c818c5e6f73a07dc8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
24  */
25 /*
26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 
30 #ifdef __RESTRICT
31 #define restrict _Restrict
32 #else
33 #define restrict
34 #endif
35 
36 /* float powf(float x, float y)
37  *
38  * Method :
39  *	1. Special cases:
40  *	for (anything) ** 0					=> 1
41  *		for (anything) ** NaN				=> QNaN + invalid
42  *		for NaN ** (anything)				=> QNaN + invalid
43  *		for +-1 ** +-Inf				=> QNaN + invalid
44  *		for +-(|x| < 1) ** +Inf				=> +0
45  *		for +-(|x| < 1) ** -Inf				=> +Inf
46  *		for +-(|x| > 1) ** +Inf				=> +Inf
47  *		for +-(|x| > 1) ** -Inf				=> +0
48  *		for +Inf ** (negative)				=> +0
49  *		for +Inf ** (positive)				=> +Inf
50  *		for -Inf ** (negative except odd integer)	=> +0
51  *		for -Inf ** (negative odd integer)		=> -0
52  *		for -Inf ** (positive except odd integer)	=> +Inf
53  *		for -Inf ** (positive odd integer)		=> -Inf
54  *		for (negative) ** (non-integer)			=> QNaN + invalid
55  *		for +0 ** (negative)				=> +Inf + overflow
56  *		for +0 ** (positive)				=> +0
57  *		for -0 ** (negative except odd integer)		=> +Inf + overflow
58  *		for -0 ** (negative odd integer)		=> -Inf + overflow
59  *		for -0 ** (positive except odd integer)		=> +0
60  *		for -0 ** (positive odd integer)		=> -0
61  *	2. Computes x**y from:
62  *		x**y = 2**(y*log2(x)) = 2**(w/256), where w = 256*log2(|x|)*y.
63  *	3. Computes w = 256 * log2(|x|) * y from
64  *		|x| = m * 2**n => log2(|x|) = n + log2(m).
65  *	Let m = m0 + dm, where m0 = 1 + k / 128,
66  *		k = [0, 128],
67  *		dm = [-1/256, 1/256].
68  *	Then 256*log2(m) = 256*log2(m0 + dm) = 256*log2(m0) + 256*log2(1+z),
69  *		where z = dm*(1/m0), z = [-1/258, 1/256].
70  *	Then
71  *		1/m0 is looked up in a table of 1, 1/(1+1/128), ..., 1/(1+128/128).
72  *		256*log2(m0) is looked up in a table of 256*log2(1), 256*log2(1+1/128),
73  *			..., 256*log2(1+128/128).
74  *		256*log2(1+z) is computed using approximation:
75  *			256*log2(1+z) = (((a3*z + a2)*z + a1)*z + a0)*z.
76  *	3. For w >= 32768
77  *		then for (negative) ** (odd integer)		=> -Inf + overflow
78  *		else						=> +Inf + overflow
79  *	For w <= -38400
80  *		then for (negative) ** (odd integer)		=> -0 + underflow
81  *		else						=> +0 + underflow
82  *	4. Computes 2 ** (w/256) from:
83  *		2 ** (w/256) = 2**a  *  2**(k/256)  *  2**(r/256)
84  *	Where:
85  *		a    =    int  ( w ) >> 8;
86  *		k    =    int  ( w ) & 0xFF;
87  *		r    =    frac ( w ).
88  *	Note that:
89  *		k = 0, 1, ..., 255;
90  *		r = (-1, 1).
91  *	Then:
92  *		2**(k/256) is looked up in a table of 2**0, 2**1/256, ...
93  *		2**(r/256) is computed using approximation:
94  *			2**(r/256) =  a0 + a1 * r + a2 * r**2
95  *		Multiplication by 2**a is done by adding "a" to
96  *		the biased exponent.
97  *	5. For (negative) ** (odd integer)	=> -(2**(w/256))
98  *	otherwise				=>   2**(w/256)
99  *
100  * Accuracy:
101  *	Max. relative aproximation error < 2**(-37.35) for 256*log2(1+z).
102  *	Max. relative aproximation error < 2**(-29.18) for 2**(r/256).
103  *	All calculations are done in double precision.
104  *	Maximum error observed: less than 0.528 ulp after 700.000.000
105  *	results.
106  */
107 
108 static void __vpowfx(int n, float * restrict px, float * restrict py,
109 	int stridey, float * restrict pz, int stridez);
110 
111 static void __vpowf_n(int n, float * restrict px, int stridex, float * restrict py,
112 	int stridey, float * restrict pz, int stridez);
113 
114 static void __vpowfx_n(int n, double yy, float * restrict py,
115 	int stridey, float * restrict pz, int stridez);
116 
117 #pragma no_inline(__vpowfx)
118 #pragma no_inline(__vpowf_n)
119 #pragma no_inline(__vpowfx_n)
120 
121 static const double __TBL_exp2f[] = {
122 	/* 2^(i/256), i = [0, 255] */
123 1.000000000000000000e+00, 1.002711275050202522e+00, 1.005429901112802726e+00,
124 1.008155898118417548e+00, 1.010889286051700475e+00, 1.013630084951489430e+00,
125 1.016378314910953096e+00, 1.019133996077737914e+00, 1.021897148654116627e+00,
126 1.024667792897135721e+00, 1.027445949118763746e+00, 1.030231637686040980e+00,
127 1.033024879021228415e+00, 1.035825693601957198e+00, 1.038634101961378731e+00,
128 1.041450124688316103e+00, 1.044273782427413755e+00, 1.047105095879289793e+00,
129 1.049944085800687210e+00, 1.052790773004626423e+00, 1.055645178360557157e+00,
130 1.058507322794512762e+00, 1.061377227289262093e+00, 1.064254912884464499e+00,
131 1.067140400676823697e+00, 1.070033711820241873e+00, 1.072934867525975555e+00,
132 1.075843889062791048e+00, 1.078760797757119860e+00, 1.081685614993215250e+00,
133 1.084618362213309206e+00, 1.087559060917769660e+00, 1.090507732665257690e+00,
134 1.093464399072885840e+00, 1.096429081816376883e+00, 1.099401802630221914e+00,
135 1.102382583307840891e+00, 1.105371445701741173e+00, 1.108368411723678726e+00,
136 1.111373503344817548e+00, 1.114386742595892432e+00, 1.117408151567369279e+00,
137 1.120437752409606746e+00, 1.123475567333019898e+00, 1.126521618608241848e+00,
138 1.129575928566288079e+00, 1.132638519598719196e+00, 1.135709414157805464e+00,
139 1.138788634756691565e+00, 1.141876203969561576e+00, 1.144972144431804173e+00,
140 1.148076478840178938e+00, 1.151189229952982673e+00, 1.154310420590215935e+00,
141 1.157440073633751121e+00, 1.160578212027498779e+00, 1.163724858777577476e+00,
142 1.166880036952481658e+00, 1.170043769683250190e+00, 1.173216080163637320e+00,
143 1.176396991650281221e+00, 1.179586527462875845e+00, 1.182784710984341014e+00,
144 1.185991565660993841e+00, 1.189207115002721027e+00, 1.192431382583151178e+00,
145 1.195664392039827328e+00, 1.198906167074380580e+00, 1.202156731452703076e+00,
146 1.205416109005123859e+00, 1.208684323626581625e+00, 1.211961399276801243e+00,
147 1.215247359980468955e+00, 1.218542229827408452e+00, 1.221846032972757623e+00,
148 1.225158793637145527e+00, 1.228480536106870025e+00, 1.231811284734075862e+00,
149 1.235151063936933413e+00, 1.238499898199816540e+00, 1.241857812073484002e+00,
150 1.245224830175257980e+00, 1.248600977189204819e+00, 1.251986277866316222e+00,
151 1.255380757024691096e+00, 1.258784439549716527e+00, 1.262197350394250739e+00,
152 1.265619514578806282e+00, 1.269050957191733220e+00, 1.272491703389402762e+00,
153 1.275941778396392001e+00, 1.279401207505669325e+00, 1.282870016078778264e+00,
154 1.286348229546025568e+00, 1.289835873406665723e+00, 1.293332973229089466e+00,
155 1.296839554651009641e+00, 1.300355643379650594e+00, 1.303881265191935812e+00,
156 1.307416445934677318e+00, 1.310961211524764414e+00, 1.314515587949354636e+00,
157 1.318079601266064049e+00, 1.321653277603157539e+00, 1.325236643159741323e+00,
158 1.328829724205954355e+00, 1.332432547083161500e+00, 1.336045138204145832e+00,
159 1.339667524053302916e+00, 1.343299731186835322e+00, 1.346941786232945804e+00,
160 1.350593715892034474e+00, 1.354255546936892651e+00, 1.357927306212901142e+00,
161 1.361609020638224754e+00, 1.365300717204011915e+00, 1.369002422974590516e+00,
162 1.372714165087668414e+00, 1.376435970754530169e+00, 1.380167867260237990e+00,
163 1.383909881963832023e+00, 1.387662042298529075e+00, 1.391424375771926236e+00,
164 1.395196909966200272e+00, 1.398979672538311236e+00, 1.402772691220204759e+00,
165 1.406575993819015435e+00, 1.410389608217270663e+00, 1.414213562373095145e+00,
166 1.418047884320415175e+00, 1.421892602169165576e+00, 1.425747744105494208e+00,
167 1.429613338391970023e+00, 1.433489413367788901e+00, 1.437375997448982368e+00,
168 1.441273119128625657e+00, 1.445180806977046650e+00, 1.449099089642035043e+00,
169 1.453027995849052623e+00, 1.456967554401443765e+00, 1.460917794180647045e+00,
170 1.464878744146405731e+00, 1.468850433336981842e+00, 1.472832890869367528e+00,
171 1.476826145939499346e+00, 1.480830227822471867e+00, 1.484845165872752393e+00,
172 1.488870989524397004e+00, 1.492907728291264835e+00, 1.496955411767235455e+00,
173 1.501014069626425584e+00, 1.505083731623406473e+00, 1.509164427593422841e+00,
174 1.513256187452609813e+00, 1.517359041198214742e+00, 1.521473018908814590e+00,
175 1.525598150744538417e+00, 1.529734466947286986e+00, 1.533881997840955913e+00,
176 1.538040773831656827e+00, 1.542210825407940744e+00, 1.546392183141021448e+00,
177 1.550584877684999974e+00, 1.554788939777088652e+00, 1.559004400237836929e+00,
178 1.563231289971357629e+00, 1.567469639965552997e+00, 1.571719481292341403e+00,
179 1.575980845107886497e+00, 1.580253762652824578e+00, 1.584538265252493749e+00,
180 1.588834384317163950e+00, 1.593142151342266999e+00, 1.597461597908627073e+00,
181 1.601792755682693414e+00, 1.606135656416771029e+00, 1.610490331949254283e+00,
182 1.614856814204860713e+00, 1.619235135194863728e+00, 1.623625327017328868e+00,
183 1.628027421857347834e+00, 1.632441451987274972e+00, 1.636867449766964411e+00,
184 1.641305447644006321e+00, 1.645755478153964946e+00, 1.650217573920617742e+00,
185 1.654691767656194301e+00, 1.659178092161616158e+00, 1.663676580326736376e+00,
186 1.668187265130582464e+00, 1.672710179641596628e+00, 1.677245357017878469e+00,
187 1.681792830507429004e+00, 1.686352633448393368e+00, 1.690924799269305279e+00,
188 1.695509361489332623e+00, 1.700106353718523478e+00, 1.704715809658051251e+00,
189 1.709337763100462926e+00, 1.713972247929925974e+00, 1.718619298122477934e+00,
190 1.723278947746273992e+00, 1.727951230961837670e+00, 1.732636182022311067e+00,
191 1.737333835273706217e+00, 1.742044225155156445e+00, 1.746767386199169048e+00,
192 1.751503353031878207e+00, 1.756252160373299454e+00, 1.761013843037583904e+00,
193 1.765788435933272726e+00, 1.770575974063554714e+00, 1.775376492526521188e+00,
194 1.780190026515424462e+00, 1.785016611318934965e+00, 1.789856282321401038e+00,
195 1.794709075003107168e+00, 1.799575024940535117e+00, 1.804454167806623932e+00,
196 1.809346539371031959e+00, 1.814252175500398856e+00, 1.819171112158608494e+00,
197 1.824103385407053413e+00, 1.829049031404897274e+00, 1.834008086409342431e+00,
198 1.838980586775893711e+00, 1.843966568958625984e+00, 1.848966069510450838e+00,
199 1.853979125083385471e+00, 1.859005772428820480e+00, 1.864046048397788979e+00,
200 1.869099989941238604e+00, 1.874167634110299963e+00, 1.879249018056560194e+00,
201 1.884344179032334532e+00, 1.889453154390939194e+00, 1.894575981586965607e+00,
202 1.899712698176555303e+00, 1.904863341817674138e+00, 1.910027950270389852e+00,
203 1.915206561397147400e+00, 1.920399213163047403e+00, 1.925605943636125028e+00,
204 1.930826790987627106e+00, 1.936061793492294347e+00, 1.941310989528640452e+00,
205 1.946574417579233218e+00, 1.951852116230978318e+00, 1.957144124175400179e+00,
206 1.962450480208927317e+00, 1.967771223233175881e+00, 1.973106392255234320e+00,
207 1.978456026387950928e+00, 1.983820164850219392e+00, 1.989198846967266343e+00,
208 1.994592112170940235e+00
209 };
210 
211 static const double __TBL_log2f[] = {
212 	/* __TBL_log2f[2*i] = 256*log2(1+i/128), i = [0, 128] */
213 	/* __TBL_log2f[2*i+1] = 2**(-23)/(1+i/128), i = [0, 128] */
214 0.000000000000000000e+00, 1.192092895507812500e-07, 2.874177388353054585e+00,
215 1.182851865310077503e-07, 5.726160135284354524e+00, 1.173753004807692373e-07,
216 8.556288393587271557e+00, 1.164793058206106825e-07, 1.136489455576407970e+01,
217 1.155968868371212153e-07, 1.415230348830453799e+01, 1.147277373120300688e-07,
218 1.691883275718974389e+01, 1.138715601679104456e-07, 1.966479284501270897e+01,
219 1.130280671296296339e-07, 2.239048736008688678e+01, 1.121969784007352926e-07,
220 2.509621323789484038e+01, 1.113780223540145949e-07, 2.778226093521127638e+01,
221 1.105709352355072477e-07, 3.044891461721790193e+01, 1.097754608812949697e-07,
222 3.309645233791141550e+01, 1.089913504464285680e-07, 3.572514621409114710e+01,
223 1.082183621453900683e-07, 3.833526259319860685e+01, 1.074562610035211292e-07,
224 4.092706221526768928e+01, 1.067048186188811188e-07, 4.350080036923196758e+01,
225 1.059638129340277719e-07, 4.605672704382322280e+01, 1.052330280172413778e-07,
226 4.859508707328441091e+01, 1.045122538527397202e-07, 5.111612027810928538e+01,
227 1.038012861394557784e-07, 5.362006160101114460e+01, 1.030999260979729787e-07,
228 5.610714123831336053e+01, 1.024079802852348971e-07, 5.857758476694550609e+01,
229 1.017252604166666732e-07, 6.103161326722020164e+01, 1.010515831953642383e-07,
230 6.346944344155788542e+01, 1.003867701480263102e-07, 6.589128772931884725e+01,
231 9.973064746732026447e-08, 6.829735441789475203e+01, 9.908304586038961692e-08,
232 7.068784775020480993e+01, 9.844380040322580637e-08, 7.306296802873558249e+01,
233 9.781275040064102225e-08, 7.542291171625650748e+01, 9.718973925159236158e-08,
234 7.776787153333835079e+01, 9.657461431962025166e-08, 8.009803655279496581e+01,
235 9.596722680817610579e-08, 8.241359229116476115e+01, 9.536743164062500529e-08,
236 8.471472079734193983e+01, 9.477508734472049048e-08, 8.700160073846393516e+01,
237 9.419005594135801946e-08, 8.927440748315585495e+01, 9.361220283742331508e-08,
238 9.153331318222942059e+01, 9.304139672256097884e-08, 9.377848684692884262e+01,
239 9.247750946969696962e-08, 9.601009442481273481e+01, 9.192041603915663129e-08,
240 9.822829887335737453e+01, 9.136999438622755046e-08, 1.004332602313626381e+02,
241 9.082612537202380448e-08, 1.026251356882391832e+02, 9.028869267751479078e-08,
242 1.048040796512516550e+02, 8.975758272058823405e-08, 1.069702438107898530e+02,
243 8.923268457602338686e-08, 1.091237772037370775e+02, 8.871388989825581272e-08,
244 1.112648262750015107e+02, 8.820109284682080489e-08, 1.133935349372744383e+02,
245 8.769419001436781487e-08, 1.155100446290761766e+02, 8.719308035714285707e-08,
246 1.176144943711480977e+02, 8.669766512784091150e-08, 1.197070208212473403e+02,
247 8.620784781073446298e-08, 1.217877583273978246e+02, 8.572353405898876167e-08,
248 1.238568389796496376e+02, 8.524463163407821503e-08, 1.259143926603967287e+02,
249 8.477105034722222546e-08, 1.279605470933005762e+02, 8.430270200276242743e-08,
250 1.299954278908662388e+02, 8.383950034340659995e-08, 1.320191586007148601e+02,
251 8.338136099726775949e-08, 1.340318607505952855e+02, 8.292820142663043248e-08,
252 1.360336538921758915e+02, 8.247994087837838296e-08, 1.380246556436560468e+02,
253 8.203650033602151192e-08, 1.400049817312349774e+02, 8.159780247326202734e-08,
254 1.419747460294751704e+02, 8.116377160904255122e-08, 1.439340606005945915e+02,
255 8.073433366402115954e-08, 1.458830357327226466e+02, 8.030941611842105082e-08,
256 1.478217799771516638e+02, 7.988894797120419333e-08, 1.497504001846159838e+02,
257 7.947285970052082892e-08, 1.516690015406285852e+02, 7.906108322538860398e-08,
258 1.535776875999046922e+02, 7.865355186855669953e-08, 1.554765603199003294e+02,
259 7.825020032051282044e-08, 1.573657200934933087e+02, 7.785096460459183052e-08,
260 1.592452657808323124e+02, 7.745578204314720208e-08, 1.611152947403800511e+02,
261 7.706459122474748130e-08, 1.629759028591741128e+02, 7.667733197236181018e-08,
262 1.648271845823295223e+02, 7.629394531250000159e-08, 1.666692329418057170e+02,
263 7.591437344527363039e-08, 1.685021395844594565e+02, 7.553855971534653557e-08,
264 1.703259947994051231e+02, 7.516644858374384321e-08, 1.721408875447028777e+02,
265 7.479798560049019504e-08, 1.739469054733941960e+02, 7.443311737804878042e-08,
266 1.757441349589039135e+02, 7.407179156553397416e-08, 1.775326611198272531e+02,
267 7.371395682367149407e-08, 1.793125678441195987e+02, 7.335956280048077330e-08,
268 1.810839378127059831e+02, 7.300856010765549954e-08, 1.828468525225273993e+02,
269 7.266090029761905417e-08, 1.846013923090393973e+02, 7.231653584123223301e-08,
270 1.863476363681789962e+02, 7.197542010613207272e-08, 1.880856627778145764e+02,
271 7.163750733568075279e-08, 1.898155485186936176e+02, 7.130275262850466758e-08,
272 1.915373694949018386e+02, 7.097111191860465018e-08, 1.932512005538479514e+02,
273 7.064254195601851460e-08, 1.949571155057867031e+02, 7.031700028801843312e-08,
274 1.966551871428931406e+02, 6.999444524082569196e-08, 1.983454872579004018e+02,
275 6.967483590182648015e-08, 2.000280866623128588e+02, 6.935813210227272390e-08,
276 2.017030552042064926e+02, 6.904429440045249486e-08, 2.033704617856271284e+02,
277 6.873328406531531472e-08, 2.050303743795980154e+02, 6.842506306053811558e-08,
278 2.066828600467466401e+02, 6.811959402901785336e-08, 2.083279849515614899e+02,
279 6.781684027777777772e-08, 2.099658143782880586e+02, 6.751676576327433535e-08,
280 2.115964127464742432e+02, 6.721933507709251725e-08, 2.132198436261738550e+02,
281 6.692451343201754014e-08, 2.148361697528176535e+02, 6.663226664847161225e-08,
282 2.164454530417600608e+02, 6.634256114130434863e-08, 2.180477546025107358e+02,
283 6.605536390692640687e-08, 2.196431347526584545e+02, 6.577064251077586116e-08,
284 2.212316530314957390e+02, 6.548836507510729591e-08, 2.228133682133515663e+02,
285 6.520850026709402365e-08, 2.243883383206399174e+02, 6.493101728723404362e-08,
286 2.259566206366313565e+02, 6.465588585805084723e-08, 2.275182717179543204e+02,
287 6.438307621308016336e-08, 2.290733474068335340e+02, 6.411255908613445100e-08,
288 2.306219028430716378e+02, 6.384430570083681460e-08, 2.321639924757807307e+02,
289 6.357828776041666578e-08, 2.336996700748701699e+02, 6.331447743775933615e-08,
290 2.352289887422961954e+02, 6.305284736570248109e-08, 2.367520009230799189e+02,
291 6.279337062757202180e-08, 2.382687584160988763e+02, 6.253602074795082293e-08,
292 2.397793123846580556e+02, 6.228077168367347501e-08, 2.412837133668454044e+02,
293 6.202759781504065697e-08, 2.427820112856774699e+02, 6.177647393724696421e-08,
294 2.442742554590400630e+02, 6.152737525201612732e-08, 2.457604946094287186e+02,
295 6.128027735943774537e-08, 2.472407768734942692e+02, 6.103515625000000127e-08,
296 2.487151498113976231e+02, 6.079198829681274795e-08, 2.501836604159786077e+02,
297 6.055075024801586965e-08, 2.516463551217433974e+02, 6.031141921936758485e-08,
298 2.531032798136744475e+02, 6.007397268700787318e-08, 2.545544798358676246e+02,
299 5.983838848039215603e-08, 2.560000000000000000e+02, 5.960464477539062500e-08
300 };
301 
302 static const double __TBL_expfb[] = {
303 7.006492321624085355e-46, 1.401298464324817071e-45, 2.802596928649634142e-45,
304 5.605193857299268284e-45, 1.121038771459853657e-44, 2.242077542919707313e-44,
305 4.484155085839414627e-44, 8.968310171678829254e-44, 1.793662034335765851e-43,
306 3.587324068671531702e-43, 7.174648137343063403e-43, 1.434929627468612681e-42,
307 2.869859254937225361e-42, 5.739718509874450723e-42, 1.147943701974890145e-41,
308 2.295887403949780289e-41, 4.591774807899560578e-41, 9.183549615799121156e-41,
309 1.836709923159824231e-40, 3.673419846319648462e-40, 7.346839692639296925e-40,
310 1.469367938527859385e-39, 2.938735877055718770e-39, 5.877471754111437540e-39,
311 1.175494350822287508e-38, 2.350988701644575016e-38, 4.701977403289150032e-38,
312 9.403954806578300064e-38, 1.880790961315660013e-37, 3.761581922631320025e-37,
313 7.523163845262640051e-37, 1.504632769052528010e-36, 3.009265538105056020e-36,
314 6.018531076210112041e-36, 1.203706215242022408e-35, 2.407412430484044816e-35,
315 4.814824860968089633e-35, 9.629649721936179265e-35, 1.925929944387235853e-34,
316 3.851859888774471706e-34, 7.703719777548943412e-34, 1.540743955509788682e-33,
317 3.081487911019577365e-33, 6.162975822039154730e-33, 1.232595164407830946e-32,
318 2.465190328815661892e-32, 4.930380657631323784e-32, 9.860761315262647568e-32,
319 1.972152263052529514e-31, 3.944304526105059027e-31, 7.888609052210118054e-31,
320 1.577721810442023611e-30, 3.155443620884047222e-30, 6.310887241768094443e-30,
321 1.262177448353618889e-29, 2.524354896707237777e-29, 5.048709793414475555e-29,
322 1.009741958682895111e-28, 2.019483917365790222e-28, 4.038967834731580444e-28,
323 8.077935669463160887e-28, 1.615587133892632177e-27, 3.231174267785264355e-27,
324 6.462348535570528710e-27, 1.292469707114105742e-26, 2.584939414228211484e-26,
325 5.169878828456422968e-26, 1.033975765691284594e-25, 2.067951531382569187e-25,
326 4.135903062765138374e-25, 8.271806125530276749e-25, 1.654361225106055350e-24,
327 3.308722450212110699e-24, 6.617444900424221399e-24, 1.323488980084844280e-23,
328 2.646977960169688560e-23, 5.293955920339377119e-23, 1.058791184067875424e-22,
329 2.117582368135750848e-22, 4.235164736271501695e-22, 8.470329472543003391e-22,
330 1.694065894508600678e-21, 3.388131789017201356e-21, 6.776263578034402713e-21,
331 1.355252715606880543e-20, 2.710505431213761085e-20, 5.421010862427522170e-20,
332 1.084202172485504434e-19, 2.168404344971008868e-19, 4.336808689942017736e-19,
333 8.673617379884035472e-19, 1.734723475976807094e-18, 3.469446951953614189e-18,
334 6.938893903907228378e-18, 1.387778780781445676e-17, 2.775557561562891351e-17,
335 5.551115123125782702e-17, 1.110223024625156540e-16, 2.220446049250313081e-16,
336 4.440892098500626162e-16, 8.881784197001252323e-16, 1.776356839400250465e-15,
337 3.552713678800500929e-15, 7.105427357601001859e-15, 1.421085471520200372e-14,
338 2.842170943040400743e-14, 5.684341886080801487e-14, 1.136868377216160297e-13,
339 2.273736754432320595e-13, 4.547473508864641190e-13, 9.094947017729282379e-13,
340 1.818989403545856476e-12, 3.637978807091712952e-12, 7.275957614183425903e-12,
341 1.455191522836685181e-11, 2.910383045673370361e-11, 5.820766091346740723e-11,
342 1.164153218269348145e-10, 2.328306436538696289e-10, 4.656612873077392578e-10,
343 9.313225746154785156e-10, 1.862645149230957031e-09, 3.725290298461914062e-09,
344 7.450580596923828125e-09, 1.490116119384765625e-08, 2.980232238769531250e-08,
345 5.960464477539062500e-08, 1.192092895507812500e-07, 2.384185791015625000e-07,
346 4.768371582031250000e-07, 9.536743164062500000e-07, 1.907348632812500000e-06,
347 3.814697265625000000e-06, 7.629394531250000000e-06, 1.525878906250000000e-05,
348 3.051757812500000000e-05, 6.103515625000000000e-05, 1.220703125000000000e-04,
349 2.441406250000000000e-04, 4.882812500000000000e-04, 9.765625000000000000e-04,
350 1.953125000000000000e-03, 3.906250000000000000e-03, 7.812500000000000000e-03,
351 1.562500000000000000e-02, 3.125000000000000000e-02, 6.250000000000000000e-02,
352 1.250000000000000000e-01, 2.500000000000000000e-01, 5.000000000000000000e-01,
353 1.000000000000000000e+00, 2.000000000000000000e+00, 4.000000000000000000e+00,
354 8.000000000000000000e+00, 1.600000000000000000e+01, 3.200000000000000000e+01,
355 6.400000000000000000e+01, 1.280000000000000000e+02, 2.560000000000000000e+02,
356 5.120000000000000000e+02, 1.024000000000000000e+03, 2.048000000000000000e+03,
357 4.096000000000000000e+03, 8.192000000000000000e+03, 1.638400000000000000e+04,
358 3.276800000000000000e+04, 6.553600000000000000e+04, 1.310720000000000000e+05,
359 2.621440000000000000e+05, 5.242880000000000000e+05, 1.048576000000000000e+06,
360 2.097152000000000000e+06, 4.194304000000000000e+06, 8.388608000000000000e+06,
361 1.677721600000000000e+07, 3.355443200000000000e+07, 6.710886400000000000e+07,
362 1.342177280000000000e+08, 2.684354560000000000e+08, 5.368709120000000000e+08,
363 1.073741824000000000e+09, 2.147483648000000000e+09, 4.294967296000000000e+09,
364 8.589934592000000000e+09, 1.717986918400000000e+10, 3.435973836800000000e+10,
365 6.871947673600000000e+10, 1.374389534720000000e+11, 2.748779069440000000e+11,
366 5.497558138880000000e+11, 1.099511627776000000e+12, 2.199023255552000000e+12,
367 4.398046511104000000e+12, 8.796093022208000000e+12, 1.759218604441600000e+13,
368 3.518437208883200000e+13, 7.036874417766400000e+13, 1.407374883553280000e+14,
369 2.814749767106560000e+14, 5.629499534213120000e+14, 1.125899906842624000e+15,
370 2.251799813685248000e+15, 4.503599627370496000e+15, 9.007199254740992000e+15,
371 1.801439850948198400e+16, 3.602879701896396800e+16, 7.205759403792793600e+16,
372 1.441151880758558720e+17, 2.882303761517117440e+17, 5.764607523034234880e+17,
373 1.152921504606846976e+18, 2.305843009213693952e+18, 4.611686018427387904e+18,
374 9.223372036854775808e+18, 1.844674407370955162e+19, 3.689348814741910323e+19,
375 7.378697629483820646e+19, 1.475739525896764129e+20, 2.951479051793528259e+20,
376 5.902958103587056517e+20, 1.180591620717411303e+21, 2.361183241434822607e+21,
377 4.722366482869645214e+21, 9.444732965739290427e+21, 1.888946593147858085e+22,
378 3.777893186295716171e+22, 7.555786372591432342e+22, 1.511157274518286468e+23,
379 3.022314549036572937e+23, 6.044629098073145874e+23, 1.208925819614629175e+24,
380 2.417851639229258349e+24, 4.835703278458516699e+24, 9.671406556917033398e+24,
381 1.934281311383406680e+25, 3.868562622766813359e+25, 7.737125245533626718e+25,
382 1.547425049106725344e+26, 3.094850098213450687e+26, 6.189700196426901374e+26,
383 1.237940039285380275e+27, 2.475880078570760550e+27, 4.951760157141521100e+27,
384 9.903520314283042199e+27, 1.980704062856608440e+28, 3.961408125713216880e+28,
385 7.922816251426433759e+28, 1.584563250285286752e+29, 3.169126500570573504e+29,
386 6.338253001141147007e+29, 1.267650600228229401e+30, 2.535301200456458803e+30,
387 5.070602400912917606e+30, 1.014120480182583521e+31, 2.028240960365167042e+31,
388 4.056481920730334085e+31, 8.112963841460668170e+31, 1.622592768292133634e+32,
389 3.245185536584267268e+32, 6.490371073168534536e+32, 1.298074214633706907e+33,
390 2.596148429267413814e+33, 5.192296858534827629e+33, 1.038459371706965526e+34,
391 2.076918743413931051e+34, 4.153837486827862103e+34, 8.307674973655724206e+34,
392 1.661534994731144841e+35, 3.323069989462289682e+35, 6.646139978924579365e+35,
393 1.329227995784915873e+36, 2.658455991569831746e+36, 5.316911983139663492e+36,
394 1.063382396627932698e+37, 2.126764793255865397e+37, 4.253529586511730793e+37,
395 8.507059173023461587e+37, 1.701411834604692317e+38, 3.402823669209384635e+38
396 };
397 
398 static const double
399 	KA3 = -3.60659926599003171364e-01*256.0,
400 	KA2 =  4.80902715189356683026e-01*256.0,
401 	KA1 = -7.21347520569871841065e-01*256.0,
402 	KA0 =  1.44269504088069658645e+00*256.0,
403 	KB2 =  3.66556671660783833261e-06,
404 	KB1 =  2.70760782821392980564e-03,
405 	DONE = 1.0,
406 	HTHRESH = 32768.0,
407 	LTHRESH = -38400.0;
408 
409 #define RETURN(ret)						\
410 {								\
411 	*pz = (ret);						\
412 	px += stridex;						\
413 	py += stridey;						\
414 	pz += stridez;						\
415 	if (n_n == 0)						\
416 	{							\
417 		spx = px; spy = py; spz = pz;			\
418 		continue;					\
419 	}							\
420 	n--;							\
421 	break;							\
422 }
423 
424 void
__vpowf(int n,float * restrict px,int stridex,float * restrict py,int stridey,float * restrict pz,int stridez)425 __vpowf(int n, float * restrict px, int stridex, float * restrict py,
426 	int stridey, float * restrict pz, int stridez)
427 {
428 	float		*spx, *spy, *spz;
429 	double		y0, yy0;
430 	long long	di0;
431 	unsigned	ux, sx, uy, ay, ax0;
432 	int		exp, i0, ind0, exp0, yisint0, n_n;
433 
434 #ifndef NOPOWFIX
435 	if (stridex == 0)
436 	{
437 		unsigned	hx = *(unsigned*)px;
438 
439 		if ((hx >= 0x00800000) &&	/* x not zero or subnormal		*/
440 		(hx < 0x7f800000) &&		/* x not inf, nan or negative sign bit	*/
441 		(hx != 0x3f800000))		/* x not 1				*/
442 		{
443 			__vpowfx(n, px, py, stridey, pz, stridez);
444 			return;
445 		}
446 	}
447 #endif
448 
449 	while (n > 0)
450 	{
451 		n_n = 0;
452 		spx = px;
453 		spy = py;
454 		spz = pz;
455 		for (; n > 0 ; n--)
456 		{
457 			uy = *(unsigned int*)py;
458 			ux = *(unsigned int*)px;
459 			ay = uy & 0x7fffffff;
460 			ax0 = ux & 0x7fffffff;
461 			sx = ux >> 31;
462 			yisint0 = 0;	/* Y - non-integer */
463 
464 			/* |X| or |Y| = Inf,Nan */
465 			if (ax0 >= 0x7f800000 || ay >= 0x7f800000)
466 			{
467 				if (ay == 0)
468 					RETURN(1.0f)	/* pow(X,0) */
469 				/* |X| or |Y| = Nan */
470 				if (ax0 > 0x7f800000 || ay > 0x7f800000)
471 					RETURN (*px + *py)
472 				if (ay == 0x7f800000)		/* |Y| = Inf */
473 				{
474 					float fy;
475 					if (ax0 == 0x3f800000)
476 						fy = *py - *py;		/* +-1 ** +-Inf = NaN */
477 					else
478 						fy = ((ax0 < 0x3f800000) != (uy >> 31)) ? 0.0f : *(float*) &ay;
479 					RETURN(fy)
480 				}
481 				if (sx)	/* X = -Inf */
482 				{
483 					exp = ay >> 23;
484 					if (exp >= 0x97)	/* |Y| >= 2^24 */
485 						yisint0 = 2;	/* Y - even */
486 					else if (exp >= 0x7f)	/* |Y| >= 1 */
487 					{
488 						i0 = ay >> ((0x7f + 23) - exp);
489 						if ((i0 << ((0x7f + 23) - exp)) == ay)
490 							yisint0 = 2 - (i0 & 1);
491 					}
492 				}
493 				if (uy >> 31)
494 					ax0 = 0;
495 				ax0 += yisint0 << 31;
496 				RETURN(*(float*)&ax0)
497 			}
498 
499 			if ((int)ux < 0x00800000)	/* X = denormal or negative */
500 			{
501 				if (ay == 0)
502 					RETURN(1.0f)	/* pow(X,0) */
503 				exp0 = (ax0 >> 23) - 127;
504 
505 				if ((int)ax0 < 0x00800000)	/* X = denormal */
506 				{
507 					*((float*) &ax0) = (float) (int)ax0;
508 					exp0 = (ax0 >> 23) - (127 + 149);
509 				}
510 
511 				if ((int)ux <= 0)	/* X <= 0 */
512 				{
513 					exp = ay >> 23;
514 					if (exp >= 0x97)	/* |Y| >= 2^24 */
515 						yisint0 = 2;	/* Y - even */
516 					else if (exp >= 0x7f)	/* |Y| >= 1 */
517 					{
518 						i0 = ay >> ((0x7f + 23) - exp);
519 						if ((i0 << ((0x7f + 23) - exp)) == ay)
520 							yisint0 = 2 - (i0 & 1);
521 					}
522 
523 					if (ax0 == 0)		/* pow(0,Y) */
524 					{
525 						float fy;
526 						fy = (uy >> 31) ? 1.0f / 0.0f : 0.0f;
527 						if (sx & yisint0)
528 							fy = -fy;
529 						RETURN(fy)
530 					}
531 
532 					if (yisint0 == 0)	/* pow(neg,non-integer) */
533 						RETURN(0.0f / 0.0f)	/* NaN */
534 				}
535 
536 				/* perform yy0 = 256*log2(xi)*yi */
537 				ax0 &= 0x007fffff;
538 				i0 = (ax0 + 0x8000) & 0xffff0000;
539 				ind0 = i0 >> 15;
540 				i0 = ax0 - i0;
541 				y0 = (double) i0 * __TBL_log2f[ind0 + 1];
542 				yy0 = __TBL_log2f[ind0] + (double) (exp0 << 8);
543 				yy0 += (((KA3 * y0 + KA2) * y0 + KA1) * y0 + KA0) * y0;
544 				yy0 = (double)py[0] * yy0;
545 
546 				/* perform 2 ** (yy0/256) */
547 				if (yy0 >= HTHRESH)
548 					yy0 = HTHRESH;
549 				if (yy0 <= LTHRESH)
550 					yy0 = LTHRESH;
551 				ind0 = (int) yy0;
552 				y0 = yy0 - (double)ind0;
553 				yy0 = (KB2 * y0 + KB1) * y0 + DONE;
554 				di0 = ((long long)((ind0 >> 8) + (yisint0 << 11))) << 52;
555 				di0 += ((long long*)__TBL_exp2f)[ind0 & 255];
556 				RETURN((float) (yy0 * *(double*)&di0))
557 			}
558 			px += stridex;
559 			py += stridey;
560 			pz += stridez;
561 			n_n++;
562 		}
563 		if (n_n > 0)
564 			__vpowf_n(n_n, spx, stridex, spy, stridey, spz, stridez);
565 	}
566 }
567 
568 
569 static void
__vpowf_n(int n,float * restrict px,int stridex,float * restrict py,int stridey,float * restrict pz,int stridez)570 __vpowf_n(int n, float * restrict px, int stridex, float * restrict py,
571 	int stridey, float * restrict pz, int stridez)
572 {
573 	double		y0, yy0;
574 	double		di0;
575 	int		ind0, i0, exp0;
576 	unsigned	ax0;
577 	double		y1, yy1;
578 	double		di1;
579 	int		ind1, i1, exp1;
580 	unsigned	ax1;
581 	double		y2, yy2;
582 	double		di2;
583 	int		ind2, i2, exp2;
584 	unsigned	ax2;
585 
586 	for (; n > 2 ; n -= 3)
587 	{
588 		/* perform yy0 = 256*log2(xi)*yi */
589 		ax0 = ((int*)px)[0];
590 		px += stridex;
591 		ax1 = ((int*)px)[0];
592 		px += stridex;
593 		ax2 = ((int*)px)[0];
594 		px += stridex;
595 		exp0 = ((ax0 & 0x7fffffff) >> 23) - 127;
596 		exp1 = ((ax1 & 0x7fffffff) >> 23) - 127;
597 		exp2 = ((ax2 & 0x7fffffff) >> 23) - 127;
598 		ax0 &= 0x007fffff;
599 		ax1 &= 0x007fffff;
600 		ax2 &= 0x007fffff;
601 		i0 = (ax0 + 0x8000) & 0xffff0000;
602 		i1 = (ax1 + 0x8000) & 0xffff0000;
603 		i2 = (ax2 + 0x8000) & 0xffff0000;
604 		ind0 = i0 >> 15;
605 		ind1 = i1 >> 15;
606 		ind2 = i2 >> 15;
607 		i0 = ax0 - i0;
608 		i1 = ax1 - i1;
609 		i2 = ax2 - i2;
610 		y0 = (double) i0 * __TBL_log2f[ind0 + 1];
611 		y1 = (double) i1 * __TBL_log2f[ind1 + 1];
612 		y2 = (double) i2 * __TBL_log2f[ind2 + 1];
613 		yy0 = __TBL_log2f[ind0] + (double) (exp0 << 8);
614 		yy1 = __TBL_log2f[ind1] + (double) (exp1 << 8);
615 		yy2 = __TBL_log2f[ind2] + (double) (exp2 << 8);
616 		yy0 += (((KA3 * y0 + KA2) * y0 + KA1) * y0 + KA0) * y0;
617 		yy1 += (((KA3 * y1 + KA2) * y1 + KA1) * y1 + KA0) * y1;
618 		yy2 += (((KA3 * y2 + KA2) * y2 + KA1) * y2 + KA0) * y2;
619 		yy0 = (double)py[0] * yy0;
620 		py += stridey;
621 		yy1 = (double)py[0] * yy1;
622 		py += stridey;
623 		yy2 = (double)py[0] * yy2;
624 		py += stridey;
625 
626 		/* perform 2 ** (yy0/256) */
627 		if (yy0 >= HTHRESH)
628 			yy0 = HTHRESH;
629 		if (yy0 <= LTHRESH)
630 			yy0 = LTHRESH;
631 		if (yy1 >= HTHRESH)
632 			yy1 = HTHRESH;
633 		if (yy1 <= LTHRESH)
634 			yy1 = LTHRESH;
635 		if (yy2 >= HTHRESH)
636 			yy2 = HTHRESH;
637 		if (yy2 <= LTHRESH)
638 			yy2 = LTHRESH;
639 
640 		ind0 = (int) yy0;
641 		ind1 = (int) yy1;
642 		ind2 = (int) yy2;
643 		y0 = yy0 - (double)ind0;
644 		y1 = yy1 - (double)ind1;
645 		y2 = yy2 - (double)ind2;
646 		yy0 = (KB2 * y0 + KB1) * y0 + DONE;
647 		yy1 = (KB2 * y1 + KB1) * y1 + DONE;
648 		yy2 = (KB2 * y2 + KB1) * y2 + DONE;
649 		di0 = (__TBL_expfb + 150)[ind0 >> 8];
650 		di1 = (__TBL_expfb + 150)[ind1 >> 8];
651 		di2 = (__TBL_expfb + 150)[ind2 >> 8];
652 		di0 *= __TBL_exp2f[ind0 & 255];
653 		di1 *= __TBL_exp2f[ind1 & 255];
654 		di2 *= __TBL_exp2f[ind2 & 255];
655 		pz[0] = (float) (yy0 * di0);
656 		pz += stridez;
657 		pz[0] = (float) (yy1 * di1);
658 		pz += stridez;
659 		pz[0] = (float) (yy2 * di2);
660 		pz += stridez;
661 	}
662 
663 	for (; n > 0 ; n--)
664 	{
665 		/* perform yy0 = 256*log2(xi)*yi */
666 		ax0 = ((int*)px)[0];
667 		exp0 = ((ax0 & 0x7fffffff) >> 23) - 127;
668 		ax0 &= 0x007fffff;
669 		i0 = (ax0 + 0x8000) & 0xffff0000;
670 		ind0 = i0 >> 15;
671 		i0 = ax0 - i0;
672 		y0 = (double) i0 * __TBL_log2f[ind0 + 1];
673 		yy0 = __TBL_log2f[ind0] + (double) (exp0 << 8);
674 		yy0 += (((KA3 * y0 + KA2) * y0 + KA1) * y0 + KA0) * y0;
675 		yy0 = (double)py[0] * yy0;
676 
677 		/* perform 2 ** (yy0/256) */
678 		if (yy0 >= HTHRESH)
679 			yy0 = HTHRESH;
680 		if (yy0 <= LTHRESH)
681 			yy0 = LTHRESH;
682 		ind0 = (int) yy0;
683 		y0 = yy0 - (double)ind0;
684 		yy0 = (KB2 * y0 + KB1) * y0 + DONE;
685 		di0 = (__TBL_expfb + 150)[ind0 >> 8];
686 		di0 *= __TBL_exp2f[ind0 & 255];
687 		pz[0] = (float) (yy0 * di0);
688 		px += stridex;
689 		py += stridey;
690 		pz += stridez;
691 	}
692 }
693 
694 
695 static void
__vpowfx(int n,float * restrict px,float * restrict py,int stridey,float * restrict pz,int stridez)696 __vpowfx(int n, float * restrict px, float * restrict py,
697 	int stridey, float * restrict pz, int stridez)
698 {
699 	float		*spy, *spz;
700 	double		yy, y0;
701 	int		ind0, exp0, i0, n_n;
702 	unsigned	ux, ax, ax0, uy, ay;
703 
704 	/* perform yy = 256*log2(xi)*yi */
705 	ux = *(unsigned int*)px;
706 	ax = ux & 0x7fffffff;
707 	exp0 = (ax >> 23) - 127;
708 	ax0 = ux & 0x007fffff;
709 	i0 = (ax0 + 0x8000) & 0xffff0000;
710 	ind0 = i0 >> 15;
711 	i0 = ax0 - i0;
712 	y0 = (double) i0 * __TBL_log2f[ind0 + 1];
713 	yy = __TBL_log2f[ind0] + (double) (exp0 << 8);
714 	yy += (((KA3 * y0 + KA2) * y0 + KA1) * y0 + KA0) * y0;
715 
716 	while (n > 0)
717 	{
718 		n_n = 0;
719 		spy = py;
720 		spz = pz;
721 		for (; n > 0 ; n--)
722 		{
723 			uy = *(unsigned int*)py;
724 			ay = uy & 0x7fffffff;
725 
726 			if (ay >= 0x7f800000)		/* |Y| = Inf or Nan */
727 			{
728 				float fy;
729 				if (ay > 0x7f800000)
730 					fy = *py + *py;	/* |Y| = Nan */
731 				else
732 					fy = ((ax < 0x3f800000) != (uy >> 31)) ? 0.0f : *(float*)&ay;
733 				*pz = fy;
734 				py += stridey;
735 				pz += stridez;
736 				if (n_n == 0)
737 				{
738 					spy = py;
739 					spz = pz;
740 					continue;
741 				}
742 				n--;
743 				break;
744 			}
745 			py += stridey;
746 			pz += stridez;
747 			n_n++;
748 		}
749 		if (n_n > 0)
750 			__vpowfx_n(n_n, yy, spy, stridey, spz, stridez);
751 	}
752 }
753 
754 
755 static void
__vpowfx_n(int n,double yy,float * restrict py,int stridey,float * restrict pz,int stridez)756 __vpowfx_n(int n, double yy, float * restrict py,
757 	int stridey, float * restrict pz, int stridez)
758 {
759 	double		y0, yy0, di0;
760 	double		y1, yy1, di1;
761 	double		y2, yy2, di2;
762 	int		ind0, ind1, ind2;
763 
764 	for (; n > 2 ; n-= 3)
765 	{
766 		/* perform 2 ** (yy/256) */
767 		yy0 = (double)py[0] * yy;
768 		py += stridey;
769 		yy1 = (double)py[0] * yy;
770 		py += stridey;
771 		yy2 = (double)py[0] * yy;
772 		py += stridey;
773 		if (yy0 >= HTHRESH)
774 			yy0 = HTHRESH;
775 		if (yy0 <= LTHRESH)
776 			yy0 = LTHRESH;
777 		if (yy1 >= HTHRESH)
778 			yy1 = HTHRESH;
779 		if (yy1 <= LTHRESH)
780 			yy1 = LTHRESH;
781 		if (yy2 >= HTHRESH)
782 			yy2 = HTHRESH;
783 		if (yy2 <= LTHRESH)
784 			yy2 = LTHRESH;
785 		ind0 = (int) yy0;
786 		ind1 = (int) yy1;
787 		ind2 = (int) yy2;
788 		y0 = yy0 - (double)ind0;
789 		y1 = yy1 - (double)ind1;
790 		y2 = yy2 - (double)ind2;
791 		yy0 = (KB2 * y0 + KB1) * y0 + DONE;
792 		yy1 = (KB2 * y1 + KB1) * y1 + DONE;
793 		yy2 = (KB2 * y2 + KB1) * y2 + DONE;
794 		di0 = (__TBL_expfb + 150)[ind0 >> 8];
795 		di1 = (__TBL_expfb + 150)[ind1 >> 8];
796 		di2 = (__TBL_expfb + 150)[ind2 >> 8];
797 		di0 *= __TBL_exp2f[ind0 & 255];
798 		di1 *= __TBL_exp2f[ind1 & 255];
799 		di2 *= __TBL_exp2f[ind2 & 255];
800 		pz[0] = (float) (yy0 * di0);
801 		pz += stridez;
802 		pz[0] = (float) (yy1 * di1);
803 		pz += stridez;
804 		pz[0] = (float) (yy2 * di2);
805 		pz += stridez;
806 	}
807 	for (; n > 0 ; n--)
808 	{
809 		/* perform 2 ** (yy/256) */
810 		yy0 = (double)py[0] * yy;
811 		if (yy0 >= HTHRESH)
812 			yy0 = HTHRESH;
813 		if (yy0 <= LTHRESH)
814 			yy0 = LTHRESH;
815 		ind0 = (int) yy0;
816 		y0 = yy0 - (double)ind0;
817 		yy0 = (KB2 * y0 + KB1) * y0 + DONE;
818 		di0 = (__TBL_expfb + 150)[ind0 >> 8];
819 		di0 *= __TBL_exp2f[ind0 & 255];
820 		pz[0] = (float) (yy0 * di0);
821 		py += stridey;
822 		pz += stridez;
823 	}
824 }
825