base/math/w_pow.c

Go to the documentation of this file.
00001 00002 00003 /* @(#)w_pow.c 5.2 93/10/01 */ 00004 /* 00005 * ==================================================== 00006 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 00007 * 00008 * Developed at SunPro, a Sun Microsystems, Inc. business. 00009 * Permission to use, copy, modify, and distribute this 00010 * software is freely granted, provided that this notice 00011 * is preserved. 00012 * ==================================================== 00013 */ 00014 00015 /* 00016 * wrapper pow(x,y) return x**y 00017 */ 00018 00019 #include "math.h" 00020 #include "mathP.h" 00021 00022 00023 #ifdef __STDC__ 00024 double pow(double x, double y) /* wrapper pow */ 00025 #else 00026 double pow(x,y) /* wrapper pow */ 00027 double x,y; 00028 #endif 00029 { 00030 #ifdef _IEEE_LIBM 00031 return __ieee754_pow(x,y); 00032 #else 00033 double z; 00034 z=__ieee754_pow(x,y); 00035 if(_LIB_VERSION == _IEEE_|| isnan(y)) return z; 00036 if(isnan(x)) { 00037 if(y==0.0) 00038 return __kernel_standard(x,y,42); /* pow(NaN,0.0) */ 00039 else 00040 return z; 00041 } 00042 if(x==0.0){ 00043 if(y==0.0) 00044 return __kernel_standard(x,y,20); /* pow(0.0,0.0) */ 00045 if(finite(y)&&y<0.0) 00046 return __kernel_standard(x,y,23); /* pow(0.0,negative) */ 00047 return z; 00048 } 00049 if(!finite(z)) { 00050 if(finite(x)&&finite(y)) { 00051 if(isnan(z)) 00052 return __kernel_standard(x,y,24); /* pow neg**non-int */ 00053 else 00054 return __kernel_standard(x,y,21); /* pow overflow */ 00055 } 00056 } 00057 if(z==0.0&&finite(x)&&finite(y)) 00058 return __kernel_standard(x,y,22); /* pow underflow */ 00059 return z; 00060 #endif 00061 }

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