12116Sjkh/* e_scalbf.c -- float version of e_scalb.c. 22116Sjkh * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 32116Sjkh */ 42116Sjkh 52116Sjkh/* 62116Sjkh * ==================================================== 72116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 82116Sjkh * 92116Sjkh * Developed at SunPro, a Sun Microsystems, Inc. business. 102116Sjkh * Permission to use, copy, modify, and distribute this 118870Srgrimes * software is freely granted, provided that this notice 122116Sjkh * is preserved. 132116Sjkh * ==================================================== 142116Sjkh */ 152116Sjkh 16176451Sdas#include <sys/cdefs.h> 17176451Sdas__FBSDID("$FreeBSD: releng/10.2/lib/msun/src/e_scalbf.c 176451 2008-02-22 02:30:36Z das $"); 182116Sjkh 192116Sjkh#include "math.h" 202116Sjkh#include "math_private.h" 212116Sjkh 222116Sjkh#ifdef _SCALB_INT 2397413Salfredfloat 2497413Salfred__ieee754_scalbf(float x, int fn) 252116Sjkh#else 2697413Salfredfloat 2797413Salfred__ieee754_scalbf(float x, float fn) 282116Sjkh#endif 292116Sjkh{ 302116Sjkh#ifdef _SCALB_INT 312116Sjkh return scalbnf(x,fn); 322116Sjkh#else 33121590Sdas if ((isnanf)(x)||(isnanf)(fn)) return x*fn; 342116Sjkh if (!finitef(fn)) { 352116Sjkh if(fn>(float)0.0) return x*fn; 362116Sjkh else return x/(-fn); 372116Sjkh } 382116Sjkh if (rintf(fn)!=fn) return (fn-fn)/(fn-fn); 392116Sjkh if ( fn > (float)65000.0) return scalbnf(x, 65000); 402116Sjkh if (-fn > (float)65000.0) return scalbnf(x,-65000); 412116Sjkh return scalbnf(x,(int)fn); 422116Sjkh#endif 432116Sjkh} 44