base/math/e_scalb.c

Go to the documentation of this file.
00001 /* @(#)e_scalb.c 5.1 93/09/24 */ 00002 /* 00003 * ==================================================== 00004 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 00005 * 00006 * Developed at SunPro, a Sun Microsystems, Inc. business. 00007 * Permission to use, copy, modify, and distribute this 00008 * software is freely granted, provided that this notice 00009 * is preserved. 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 * __ieee754_scalb(x, fn) is provide for 00019 * passing various standard test suite. One 00020 * should use scalbn() instead. 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 }

Generated on Thu Nov 20 11:49:51 2008 for RTAI API by doxygen 1.3.8