base/math/w_exp.c

Go to the documentation of this file.
00001 /* @(#)w_exp.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: w_exp.c,v 1.6 1995/05/10 20:48:51 jtc Exp $"; 00015 #endif 00016 00017 /* 00018 * wrapper exp(x) 00019 */ 00020 00021 #include "math.h" 00022 #include "mathP.h" 00023 00024 #ifdef __STDC__ 00025 static const double 00026 #else 00027 static double 00028 #endif 00029 o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ 00030 u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ 00031 00032 #ifdef __STDC__ 00033 double exp(double x) /* wrapper exp */ 00034 #else 00035 double exp(x) /* wrapper exp */ 00036 double x; 00037 #endif 00038 { 00039 #ifdef _IEEE_LIBM 00040 return __ieee754_exp(x); 00041 #else 00042 double z; 00043 z = __ieee754_exp(x); 00044 if(_LIB_VERSION == _IEEE_) return z; 00045 if(finite(x)) { 00046 if(x>o_threshold) 00047 return __kernel_standard(x,x,6); /* exp overflow */ 00048 else if(x<u_threshold) 00049 return __kernel_standard(x,x,7); /* exp underflow */ 00050 } 00051 return z; 00052 #endif 00053 }

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