1 /* sf_ldexp.c -- float version of s_ldexp.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 #include "fdlibm.h" 17 #include <errno.h> 18 19 #ifdef __STDC__ ldexpf(float value,int exp)20 float ldexpf(float value, int exp) 21 #else 22 float ldexpf(value, exp) 23 float value; int exp; 24 #endif 25 { 26 if(!finitef(value)||value==(float)0.0) return value; 27 value = scalbnf(value,exp); 28 if(!finitef(value)||value==(float)0.0) errno = ERANGE; 29 return value; 30 } 31 32 #ifdef _DOUBLE_IS_32BITS 33 34 #ifdef __STDC__ ldexp(double value,int exp)35 double ldexp(double value, int exp) 36 #else 37 double ldexp(value, exp) 38 double value; int exp; 39 #endif 40 { 41 return (double) ldexpf((float) value, exp); 42 } 43 44 #endif /* defined(_DOUBLE_IS_32BITS) */ 45