1/* e_jnf.c -- float version of e_jn.c. 2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 3 */ 4 5/* 6 * ==================================================== 7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 8 * 9 * Developed at SunPro, a Sun Microsystems, Inc. business. 10 * Permission to use, copy, modify, and distribute this 11 * software is freely granted, provided that this notice 12 * is preserved. 13 * ==================================================== 14 */ 15 16#ifndef lint |
17static char rcsid[] = "$Id: e_jnf.c,v 1.1.1.1 1994/08/19 09:39:55 jkh Exp $"; |
18#endif 19 20#include "math.h" 21#include "math_private.h" 22 23#ifdef __STDC__ 24static const float 25#else --- 161 unchanged lines hidden (view full) --- 187 ix = 0x7fffffff&hx; 188 /* if Y(n,NaN) is NaN */ 189 if(ix>0x7f800000) return x+x; 190 if(ix==0) return -one/zero; 191 if(hx<0) return zero/zero; 192 sign = 1; 193 if(n<0){ 194 n = -n; |
195 sign = 1 - ((n&1)<<1); |
196 } 197 if(n==0) return(__ieee754_y0f(x)); 198 if(n==1) return(sign*__ieee754_y1f(x)); 199 if(ix==0x7f800000) return zero; 200 201 a = __ieee754_y0f(x); 202 b = __ieee754_y1f(x); 203 /* quit if b is -inf */ 204 GET_FLOAT_WORD(ib,b); 205 for(i=1;i<n&&ib!=0xff800000;i++){ 206 temp = b; 207 b = ((float)(i+i)/x)*b - a; 208 GET_FLOAT_WORD(ib,b); 209 a = temp; 210 } 211 if(sign>0) return b; else return -b; 212} |