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