Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

generic_math.h

Go to the documentation of this file.
00001 #ifndef GENERIC_MATH_H
00002 #define GENERIC_MATH_H
00003 
00004 #ifndef RSDEF_H
00005 #include <rsdef.h>
00006 #endif
00007 
00008 
00009 namespace rs {
00011     namespace gen_math {
00012 
00014         typedef long double LongDouble;
00015 
00020         template<int X, int Y> struct Power { static const LongDouble value = X*Power<X, Y-1>::value; };
00021 
00023         template<int X> struct Power<X, 0> { static const LongDouble value = 1; };
00024 
00029         template<int N> struct Factorial {static const LongDouble value = N * Factorial<N-1>::value;};
00030 
00032         struct Factorial<0> { static const LongDouble value = 1; };
00033     };
00034 
00035 };
00036 
00037 #else
00038 #error generic_math.h included twice
00039 #endif // GENERIC_MATH_H

Contact me in case of errors or questions.
This documentation is powered by Doxygen.
(C) 2000-2002 Doxygen