inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/math
Go to the documentation of this file.
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
00002 // See the file inlib.license for terms.
00003 
00004 #ifndef inlib_math
00005 #define inlib_math
00006 
00007 namespace inlib {
00008 
00009 //have : static const pi = 3.1415926535897931160E0; ???
00010 
00011 //HEALPix lsconstants.h. Quite not the same as us.
00012 //const double pi=3.141592653589793238462643383279502884197;
00013 //const double twopi=6.283185307179586476925286766559005768394;
00014 //const double fourpi=12.56637061435917295385057353311801153679;
00015 //const double halfpi=1.570796326794896619231321691639751442099;
00016 
00017 inline double pi()      {return 3.1415926535897931160E0;}
00018 inline double two_pi()  {return 6.2831853071795862320E0;}
00019 inline double half_pi() {return 1.5707963267948965580E0;}
00020 
00021 template <class T>
00022 inline T power(const T& a_A,unsigned int a_B){
00023   T v = 1;
00024   for(unsigned int i=0;i<a_B;i++) v *= a_A; 
00025   return v;
00026 }
00027 
00028 // for Lib/ExpFunc.
00029 inline bool in_domain_all(double){return true;}
00030 inline bool in_domain_log(double a_x){return (a_x>0?true:false);}
00031 inline bool in_domain_tan(double a_x){
00032   int n = int(a_x/half_pi());
00033   if(a_x!=n*half_pi()) return true;
00034   return (2*int(n/2)==n?true:false);    
00035 }
00036 inline bool in_domain_acos(double a_x){
00037   if((a_x<-1)||(1<a_x)) return false;
00038   return true;
00039 }
00040 
00041 }
00042 
00043 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines