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 #include <sys/isa_defs.h>
31 #include "libm_synonyms.h"
32 #include "libm_inlines.h"
33
34 #ifdef _LITTLE_ENDIAN
35 #define HI(x) *(1+(int*)x)
36 #define LO(x) *(unsigned*)x
37 #else
38 #define HI(x) *(int*)x
39 #define LO(x) *(1+(unsigned*)x)
40 #endif
41
42 #ifdef __RESTRICT
43 #define restrict _Restrict
44 #else
45 #define restrict
46 #endif
47
48 /* float rhypotf(float x, float y)
49 *
50 * Method :
51 * 1. Special cases:
202 5.8181818181818178992e-01, 1.9069251784911847580e-01,
203 5.7657657657657657158e-01, 1.8983159915049979682e-01,
204 5.7142857142857139685e-01, 1.8898223650461362655e-01,
205 5.6637168141592919568e-01, 1.8814417367671945613e-01,
206 5.6140350877192979340e-01, 1.8731716231633879777e-01,
207 5.5652173913043478937e-01, 1.8650096164806276300e-01,
208 5.5172413793103447510e-01, 1.8569533817705186074e-01,
209 5.4700854700854706358e-01, 1.8490006540840969729e-01,
210 5.4237288135593220151e-01, 1.8411492357966466327e-01,
211 5.3781512605042014474e-01, 1.8333969940564226464e-01,
212 5.3333333333333332593e-01, 1.8257418583505535814e-01,
213 5.2892561983471075848e-01, 1.8181818181818182323e-01,
214 5.2459016393442625681e-01, 1.8107149208503706128e-01,
215 5.2032520325203257539e-01, 1.8033392693348646030e-01,
216 5.1612903225806450180e-01, 1.7960530202677491007e-01,
217 5.1200000000000001066e-01, 1.7888543819998317663e-01,
218 5.0793650793650790831e-01, 1.7817416127494958844e-01,
219 5.0393700787401574104e-01, 1.7747130188322274291e-01,
220 };
221
222 #define fabsf __fabsf
223
224 extern float fabsf(float);
225
226 static const double
227 A0 = 9.99999997962321453275e-01,
228 A1 =-4.99999998166077580600e-01,
229 A2 = 3.75066768969515586277e-01,
230 A3 =-3.12560092408808548438e-01;
231
232 static void
233 __vrhypotf_n(int n, float * restrict px, int stridex, float * restrict py,
234 int stridey, float * restrict pz, int stridez);
235
236 #pragma no_inline(__vrhypotf_n)
237
238 #define RETURN(ret) \
239 { \
240 *pz = (ret); \
241 pz += stridez; \
242 if (n_n == 0) \
243 { \
445 ibase0 = HI(&hyp0);
446
447 HI(&dbase0) = (0x60000000 - ((ibase0 & 0x7fe00000) >> 1));
448
449 hyp0h = (ibase0 & 0x000fffff) | 0x3ff00000;
450 HI(&hyp0) = hyp0h;
451 HI(&h_hi0) = hyp0h & 0x7fffc000;
452
453 ibase0 >>= 10;
454 si0 = ibase0 & 0x7f0;
455 xx0 = ((double*)((char*)__vlibm_TBL_rhypotf + si0))[0];
456
457 xx0 = (hyp0 - h_hi0) * xx0;
458 res0 = ((double*)((char*)__vlibm_TBL_rhypotf + si0))[1];
459 res0 *= (((A3 * xx0 + A2) * xx0 + A1) * xx0 + A0);
460 res0 *= dbase0;
461 *pz = res0;
462 pz += stridez;
463 }
464 }
465
|
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 #include <sys/isa_defs.h>
31 #include "libm_inlines.h"
32
33 #ifdef _LITTLE_ENDIAN
34 #define HI(x) *(1+(int*)x)
35 #define LO(x) *(unsigned*)x
36 #else
37 #define HI(x) *(int*)x
38 #define LO(x) *(1+(unsigned*)x)
39 #endif
40
41 #ifdef __RESTRICT
42 #define restrict _Restrict
43 #else
44 #define restrict
45 #endif
46
47 /* float rhypotf(float x, float y)
48 *
49 * Method :
50 * 1. Special cases:
201 5.8181818181818178992e-01, 1.9069251784911847580e-01,
202 5.7657657657657657158e-01, 1.8983159915049979682e-01,
203 5.7142857142857139685e-01, 1.8898223650461362655e-01,
204 5.6637168141592919568e-01, 1.8814417367671945613e-01,
205 5.6140350877192979340e-01, 1.8731716231633879777e-01,
206 5.5652173913043478937e-01, 1.8650096164806276300e-01,
207 5.5172413793103447510e-01, 1.8569533817705186074e-01,
208 5.4700854700854706358e-01, 1.8490006540840969729e-01,
209 5.4237288135593220151e-01, 1.8411492357966466327e-01,
210 5.3781512605042014474e-01, 1.8333969940564226464e-01,
211 5.3333333333333332593e-01, 1.8257418583505535814e-01,
212 5.2892561983471075848e-01, 1.8181818181818182323e-01,
213 5.2459016393442625681e-01, 1.8107149208503706128e-01,
214 5.2032520325203257539e-01, 1.8033392693348646030e-01,
215 5.1612903225806450180e-01, 1.7960530202677491007e-01,
216 5.1200000000000001066e-01, 1.7888543819998317663e-01,
217 5.0793650793650790831e-01, 1.7817416127494958844e-01,
218 5.0393700787401574104e-01, 1.7747130188322274291e-01,
219 };
220
221 extern float fabsf(float);
222
223 static const double
224 A0 = 9.99999997962321453275e-01,
225 A1 =-4.99999998166077580600e-01,
226 A2 = 3.75066768969515586277e-01,
227 A3 =-3.12560092408808548438e-01;
228
229 static void
230 __vrhypotf_n(int n, float * restrict px, int stridex, float * restrict py,
231 int stridey, float * restrict pz, int stridez);
232
233 #pragma no_inline(__vrhypotf_n)
234
235 #define RETURN(ret) \
236 { \
237 *pz = (ret); \
238 pz += stridez; \
239 if (n_n == 0) \
240 { \
442 ibase0 = HI(&hyp0);
443
444 HI(&dbase0) = (0x60000000 - ((ibase0 & 0x7fe00000) >> 1));
445
446 hyp0h = (ibase0 & 0x000fffff) | 0x3ff00000;
447 HI(&hyp0) = hyp0h;
448 HI(&h_hi0) = hyp0h & 0x7fffc000;
449
450 ibase0 >>= 10;
451 si0 = ibase0 & 0x7f0;
452 xx0 = ((double*)((char*)__vlibm_TBL_rhypotf + si0))[0];
453
454 xx0 = (hyp0 - h_hi0) * xx0;
455 res0 = ((double*)((char*)__vlibm_TBL_rhypotf + si0))[1];
456 res0 *= (((A3 * xx0 + A2) * xx0 + A1) * xx0 + A0);
457 res0 *= dbase0;
458 *pz = res0;
459 pz += stridez;
460 }
461 }
|