1141296Sdas 2141296Sdas/* @(#)e_scalb.c 1.3 95/01/18 */ 32116Sjkh/* 42116Sjkh * ==================================================== 52116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 62116Sjkh * 7141296Sdas * Developed at SunSoft, a Sun Microsystems, Inc. business. 82116Sjkh * Permission to use, copy, modify, and distribute this 9141296Sdas * software is freely granted, provided that this notice 102116Sjkh * is preserved. 112116Sjkh * ==================================================== 122116Sjkh */ 132116Sjkh 14176451Sdas#include <sys/cdefs.h> 15176451Sdas__FBSDID("$FreeBSD: releng/10.2/lib/msun/src/e_scalb.c 176451 2008-02-22 02:30:36Z das $"); 162116Sjkh 172116Sjkh/* 182116Sjkh * __ieee754_scalb(x, fn) is provide for 19141296Sdas * passing various standard test suite. One 202116Sjkh * should use scalbn() instead. 212116Sjkh */ 222116Sjkh 232116Sjkh#include "math.h" 242116Sjkh#include "math_private.h" 252116Sjkh 262116Sjkh#ifdef _SCALB_INT 2797413Salfreddouble 28117912Speter__ieee754_scalb(double x, int fn) 292116Sjkh#else 3097413Salfreddouble 31117912Speter__ieee754_scalb(double x, double fn) 322116Sjkh#endif 332116Sjkh{ 342116Sjkh#ifdef _SCALB_INT 352116Sjkh return scalbn(x,fn); 362116Sjkh#else 37141296Sdas if (isnan(x)||isnan(fn)) return x*fn; 382116Sjkh if (!finite(fn)) { 392116Sjkh if(fn>0.0) return x*fn; 402116Sjkh else return x/(-fn); 412116Sjkh } 422116Sjkh if (rint(fn)!=fn) return (fn-fn)/(fn-fn); 432116Sjkh if ( fn > 65000.0) return scalbn(x, 65000); 442116Sjkh if (-fn > 65000.0) return scalbn(x,-65000); 452116Sjkh return scalbn(x,(int)fn); 462116Sjkh#endif 472116Sjkh} 48