OSDN Git Service

libm/*: mass removal of:
[uclinux-h8/uclibc-ng.git] / libm / e_scalb.c
1 /*
2  * ====================================================
3  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4  *
5  * Developed at SunPro, a Sun Microsystems, Inc. business.
6  * Permission to use, copy, modify, and distribute this
7  * software is freely granted, provided that this notice
8  * is preserved.
9  * ====================================================
10  */
11
12 /*
13  * __ieee754_scalb(x, fn) is provide for
14  * passing various standard test suite. One
15  * should use scalbn() instead.
16  */
17
18 #include "math.h"
19 #include "math_private.h"
20
21 #ifdef _SCALB_INT
22 double attribute_hidden __ieee754_scalb(double x, int fn)
23 #else
24 double attribute_hidden __ieee754_scalb(double x, double fn)
25 #endif
26 {
27 #ifdef _SCALB_INT
28         return scalbn(x,fn);
29 #else
30         if (isnan(x)||isnan(fn)) return x*fn;
31         if (!isfinite(fn)) {
32             if(fn>0.0) return x*fn;
33             else       return x/(-fn);
34         }
35         if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
36         if ( fn > 65000.0) return scalbn(x, 65000);
37         if (-fn > 65000.0) return scalbn(x,-65000);
38         return scalbn(x,(int)fn);
39 #endif
40 }