e_pow.c (7e546392b5fe3a496acff53ac7aadd1c57b2a4cf) e_pow.c (9faa8dc6cc23363b3d8897598cff7d3a40045a46)
1/* @(#)e_pow.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
9 * is preserved.
10 * ====================================================
11 */
12
13#ifndef lint
1/* @(#)e_pow.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
9 * is preserved.
10 * ====================================================
11 */
12
13#ifndef lint
14static char rcsid[] = "$Id$";
14static char rcsid[] = "$Id: e_pow.c,v 1.4 1997/02/22 15:10:29 peter Exp $";
15#endif
16
17/* __ieee754_pow(x,y) return x**y
18 *
19 * n
20 * Method: Let x = 2 * (1+f)
21 * 1. Compute and return log2(x) in two pieces:
22 * log2(x) = w1 + w2,

--- 132 unchanged lines hidden (view full) ---

155 return (hy<0)?-y: zero;
156 }
157 if(iy==0x3ff00000) { /* y is +-1 */
158 if(hy<0) return one/x; else return x;
159 }
160 if(hy==0x40000000) return x*x; /* y is 2 */
161 if(hy==0x3fe00000) { /* y is 0.5 */
162 if(hx>=0) /* x >= +0 */
15#endif
16
17/* __ieee754_pow(x,y) return x**y
18 *
19 * n
20 * Method: Let x = 2 * (1+f)
21 * 1. Compute and return log2(x) in two pieces:
22 * log2(x) = w1 + w2,

--- 132 unchanged lines hidden (view full) ---

155 return (hy<0)?-y: zero;
156 }
157 if(iy==0x3ff00000) { /* y is +-1 */
158 if(hy<0) return one/x; else return x;
159 }
160 if(hy==0x40000000) return x*x; /* y is 2 */
161 if(hy==0x3fe00000) { /* y is 0.5 */
162 if(hx>=0) /* x >= +0 */
163 return sqrt(x);
163 return __ieee754_sqrt(x);
164 }
165 }
166
167 ax = fabs(x);
168 /* special value of x */
169 if(lx==0) {
170 if(ix==0x7ff00000||ix==0||ix==0x3ff00000){
171 z = ax; /*x is +-0,+-inf,+-1*/

--- 141 unchanged lines hidden ---
164 }
165 }
166
167 ax = fabs(x);
168 /* special value of x */
169 if(lx==0) {
170 if(ix==0x7ff00000||ix==0||ix==0x3ff00000){
171 z = ax; /*x is +-0,+-inf,+-1*/

--- 141 unchanged lines hidden ---