base/math/w_scalb.c

Go to the documentation of this file.
00001 #if !defined(__ppc__)
00002 /* @(#)w_scalb.c 5.1 93/09/24 */
00003 /*
00004  * ====================================================
00005  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00006  *
00007  * Developed at SunPro, a Sun Microsystems, Inc. business.
00008  * Permission to use, copy, modify, and distribute this
00009  * software is freely granted, provided that this notice 
00010  * is preserved.
00011  * ====================================================
00012  */
00013 
00014 #if defined(LIBM_SCCS) && !defined(lint)
00015 static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $";
00016 #endif
00017 
00018 /*
00019  * wrapper scalb(double x, double fn) is provide for
00020  * passing various standard test suite. One 
00021  * should use scalbn() instead.
00022  */
00023 
00024 #include "math.h"
00025 #include "mathP.h"
00026 
00027 #include <linux/errno.h>
00028 
00029 extern int libm_errno;
00030 
00031 #ifdef __STDC__
00032 #ifdef _SCALB_INT
00033     double scalb(double x, int fn)      /* wrapper scalb */
00034 #else
00035     double scalb(double x, double fn)   /* wrapper scalb */
00036 #endif
00037 #else
00038     double scalb(x,fn)          /* wrapper scalb */
00039 #ifdef _SCALB_INT
00040     double x; int fn;
00041 #else
00042     double x,fn;
00043 #endif
00044 #endif
00045 {
00046 #ifdef _IEEE_LIBM
00047     return __ieee754_scalb(x,fn);
00048 #else
00049     double z;
00050     z = __ieee754_scalb(x,fn);
00051     if(_LIB_VERSION == _IEEE_) return z;
00052     if(!(finite(z)||isnan(z))&&finite(x)) {
00053         return __kernel_standard(x,(double)fn,32); /* scalb overflow */
00054     }
00055     if(z==0.0&&z!=x) {
00056         return __kernel_standard(x,(double)fn,33); /* scalb underflow */
00057     } 
00058 #ifndef _SCALB_INT
00059     if(!finite(fn)) libm_errno = ERANGE;
00060 #endif
00061     return z;
00062 #endif 
00063 }
00064 #endif /* !__ppc__ */

Generated on Tue Feb 2 17:46:05 2010 for RTAI API by  doxygen 1.4.7