e_pow.c (141296) | e_pow.c (176266) |
---|---|
1/* @(#)e_pow.c 1.5 04/04/22 SMI */ 2/* 3 * ==================================================== 4 * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Permission to use, copy, modify, and distribute this 7 * software is freely granted, provided that this notice 8 * is preserved. 9 * ==================================================== 10 */ 11 | 1/* @(#)e_pow.c 1.5 04/04/22 SMI */ 2/* 3 * ==================================================== 4 * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Permission to use, copy, modify, and distribute this 7 * software is freely granted, provided that this notice 8 * is preserved. 9 * ==================================================== 10 */ 11 |
12#ifndef lint 13static char rcsid[] = "$FreeBSD: head/lib/msun/src/e_pow.c 141296 2005-02-04 18:26:06Z das $"; 14#endif | 12#include <sys/cdefs.h> 13__FBSDID("$FreeBSD: head/lib/msun/src/e_pow.c 176266 2008-02-14 09:42:24Z bde $"); |
15 16/* __ieee754_pow(x,y) return x**y 17 * 18 * n 19 * Method: Let x = 2 * (1+f) 20 * 1. Compute and return log2(x) in two pieces: 21 * log2(x) = w1 + w2, 22 * where w1 has 53-24 = 29 bit trailing zeros. --- 82 unchanged lines hidden (view full) --- 105 106 EXTRACT_WORDS(hx,lx,x); 107 EXTRACT_WORDS(hy,ly,y); 108 ix = hx&0x7fffffff; iy = hy&0x7fffffff; 109 110 /* y==zero: x**0 = 1 */ 111 if((iy|ly)==0) return one; 112 | 14 15/* __ieee754_pow(x,y) return x**y 16 * 17 * n 18 * Method: Let x = 2 * (1+f) 19 * 1. Compute and return log2(x) in two pieces: 20 * log2(x) = w1 + w2, 21 * where w1 has 53-24 = 29 bit trailing zeros. --- 82 unchanged lines hidden (view full) --- 104 105 EXTRACT_WORDS(hx,lx,x); 106 EXTRACT_WORDS(hy,ly,y); 107 ix = hx&0x7fffffff; iy = hy&0x7fffffff; 108 109 /* y==zero: x**0 = 1 */ 110 if((iy|ly)==0) return one; 111 |
113 /* +-NaN return x+y */ | 112 /* y!=zero: result is NaN if either arg is NaN */ |
114 if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || 115 iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) | 113 if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || 114 iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) |
116 return x+y; | 115 return (x+0.0)+(y+0.0); |
117 118 /* determine if y is an odd int when x < 0 119 * yisint = 0 ... y is not an integer 120 * yisint = 1 ... y is an odd int 121 * yisint = 2 ... y is an even int 122 */ 123 yisint = 0; 124 if(hx<0) { --- 180 unchanged lines hidden --- | 116 117 /* determine if y is an odd int when x < 0 118 * yisint = 0 ... y is not an integer 119 * yisint = 1 ... y is an odd int 120 * yisint = 2 ... y is an even int 121 */ 122 yisint = 0; 123 if(hx<0) { --- 180 unchanged lines hidden --- |