00001 00006 /*----------------------------------------------------------------------------*/ 00007 /* C Tool Box: Designed and implemented by: */ 00008 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00009 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00010 /* Email: W.F.J.Mueller@gsi.de */ 00011 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00012 /*------------------------------------------+---------------------------------*/ 00013 00014 #include <math.h> 00015 00016 #include "CTBnum.hxx" 00017 00018 //------------------------------------------+----------------------------------- 00020 00024 inline double CTBsin(double x) { return sin(x); } 00025 00026 //------------------------------------------+----------------------------------- 00028 00032 inline float CTBsin(float x) { return sinf(x); } 00033 00034 //------------------------------------------+----------------------------------- 00036 00040 inline double CTBcos(double x) { return cos(x); } 00041 00042 //------------------------------------------+----------------------------------- 00044 00048 inline float CTBcos(float x) { return cosf(x); } 00049 00050 //------------------------------------------+----------------------------------- 00052 00056 inline double CTBtan(double x) { return tan(x); } 00057 00058 //------------------------------------------+----------------------------------- 00060 00064 inline float CTBtan(float x) { return tanf(x); } 00065 00066 //------------------------------------------+----------------------------------- 00068 00072 inline double CTBatan(double x) { return atan(x); } 00073 00074 //------------------------------------------+----------------------------------- 00076 00080 inline float CTBatan(float x) { return atanf(x); } 00081 00082 //------------------------------------------+----------------------------------- 00084 00096 inline double CTBacos2(double y, double x) 00097 { 00098 return acos((x==0.) ? CTBsign(1.,y) : CTBmax(-1., CTBmin(+1., y/x))); 00099 } 00100 00101 //------------------------------------------+----------------------------------- 00103 00115 inline float CTBacos2(float y, float x) 00116 { 00117 return acos((x==0.) ? CTBsign(1.f,y) : CTBmax(-1.f, CTBmin(+1.f, y/x))); 00118 } 00119 00120 //------------------------------------------+----------------------------------- 00122 00126 inline double CTBatan2(double y, double x) { return atan2(y, x); } 00127 00128 //------------------------------------------+----------------------------------- 00130 00134 inline float CTBatan2(float y, float x) { return atan2f(y, x); } 00135 00136 //------------------------------------------+----------------------------------- 00138 00142 inline double CTBsinh(double x) { return sinh(x); } 00143 00144 //------------------------------------------+----------------------------------- 00146 00150 inline float CTBsinh(float x) { return sinhf(x); } 00151 00152 //------------------------------------------+----------------------------------- 00154 00158 inline double CTBcosh(double x) { return cosh(x); } 00159 00160 //------------------------------------------+----------------------------------- 00162 00166 inline float CTBcosh(float x) { return coshf(x); } 00167 00168 //------------------------------------------+----------------------------------- 00170 00174 inline double CTBtanh(double x) { return tanh(x); } 00175 00176 //------------------------------------------+----------------------------------- 00178 00182 inline float CTBtanh(float x) { return tanhf(x); } 00183 00184 //------------------------------------------+----------------------------------- 00186 00190 inline double CTBasinh(double x) { return asinh(x); } 00191 00192 //------------------------------------------+----------------------------------- 00194 00198 inline float CTBasinh(float x) { return asinhf(x); } 00199 00200 //------------------------------------------+----------------------------------- 00202 00206 inline double CTBacosh(double x) { return acosh(x); } 00207 00208 //------------------------------------------+----------------------------------- 00210 00214 inline float CTBacosh(float x) { return acoshf(x); } 00215 00216 //------------------------------------------+----------------------------------- 00218 00222 inline double CTBatanh(double x) { return atanh(x); } 00223 00224 //------------------------------------------+----------------------------------- 00226 00230 inline float CTBatanh(float x) { return atanhf(x); } 00231 00232 //------------------------------------------+----------------------------------- 00234 00240 inline double CTBpow(double x, double y) { return CTBexp(y * CTBlog(x)); } 00241 00242 //------------------------------------------+----------------------------------- 00244 00250 inline float CTBpow(float x, float y) { return CTBexp(y * CTBlog(x)); } 00251 00252 //------------------------------------------+----------------------------------- 00254 00258 template <class T> 00259 inline T CTBpow2(T x) 00260 { 00261 return x * x; 00262 } 00263 00264 //------------------------------------------+----------------------------------- 00266 00270 template <class T> 00271 inline T CTBpow3(T x) 00272 { 00273 return x * x * x; 00274 } 00275 00276 //------------------------------------------+----------------------------------- 00278 00282 template <class T> 00283 inline T CTBpow4(T x) 00284 { 00285 T x2 = x * x; 00286 return x2 * x2; 00287 } 00288 00289 //------------------------------------------+----------------------------------- 00291 00295 inline double CTBerf(double x) { return erf(x); } 00296 00297 //------------------------------------------+----------------------------------- 00299 00303 inline float CTBerf(float x) { return erff(x); } 00304 00305 //------------------------------------------+-----------------------------------