1 /* @(#)e_scalb.c 5.1 93/09/24 */
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
10 * ====================================================
12 * $FreeBSD: src/lib/msun/src/e_scalb.c,v 1.6 1999/08/28 00:06:38 peter Exp $
13 * $DragonFly: src/lib/msun/src/Attic/e_scalb.c,v 1.2 2003/06/17 04:26:53 dillon Exp $
17 * __ieee754_scalb(x, fn) is provide for
18 * passing various standard test suite. One
19 * should use scalbn() instead.
23 #include "math_private.h"
27 double __generic___ieee754_scalb(double x, int fn)
29 double __generic___ieee754_scalb(x,fn)
34 double __generic___ieee754_scalb(double x, double fn)
36 double __generic___ieee754_scalb(x,fn)
44 if (isnan(x)||isnan(fn)) return x*fn;
46 if(fn>0.0) return x*fn;
49 if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
50 if ( fn > 65000.0) return scalbn(x, 65000);
51 if (-fn > 65000.0) return scalbn(x,-65000);
52 return scalbn(x,(int)fn);