00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #if defined(LIBM_SCCS) && !defined(lint)
00014 static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $";
00015 #endif
00016
00017
00018
00019
00020
00021
00022
00023 #include "math.h"
00024 #include "mathP.h"
00025
00026 #ifdef _SCALB_INT
00027 #ifdef __STDC__
00028 double __ieee754_scalb(double x, int fn)
00029 #else
00030 double __ieee754_scalb(x,fn)
00031 double x; int fn;
00032 #endif
00033 #else
00034 #ifdef __STDC__
00035 double __ieee754_scalb(double x, double fn)
00036 #else
00037 double __ieee754_scalb(x,fn)
00038 double x, fn;
00039 #endif
00040 #endif
00041 {
00042 #ifdef _SCALB_INT
00043 return scalbn(x,fn);
00044 #else
00045 if (isnan(x)||isnan(fn)) return x*fn;
00046 if (!finite(fn)) {
00047 if(fn>0.0) return x*fn;
00048 else return x/(-fn);
00049 }
00050 if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
00051 if ( fn > 65000.0) return scalbn(x, 65000);
00052 if (-fn > 65000.0) return scalbn(x,-65000);
00053 return scalbn(x,(int)fn);
00054 #endif
00055 }