Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / lib / msun / src / e_scalb.c
1 /* @(#)e_scalb.c 5.1 93/09/24 */
2 /*
3  * ====================================================
4  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5  *
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
9  * is preserved.
10  * ====================================================
11  *
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 $
14  */
15
16 /*
17  * __ieee754_scalb(x, fn) is provide for
18  * passing various standard test suite. One
19  * should use scalbn() instead.
20  */
21
22 #include "math.h"
23 #include "math_private.h"
24
25 #ifdef _SCALB_INT
26 #ifdef __STDC__
27         double __generic___ieee754_scalb(double x, int fn)
28 #else
29         double __generic___ieee754_scalb(x,fn)
30         double x; int fn;
31 #endif
32 #else
33 #ifdef __STDC__
34         double __generic___ieee754_scalb(double x, double fn)
35 #else
36         double __generic___ieee754_scalb(x,fn)
37         double x, fn;
38 #endif
39 #endif
40 {
41 #ifdef _SCALB_INT
42         return scalbn(x,fn);
43 #else
44         if (isnan(x)||isnan(fn)) return x*fn;
45         if (!finite(fn)) {
46             if(fn>0.0) return x*fn;
47             else       return x/(-fn);
48         }
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);
53 #endif
54 }