|
activemq-cpp-3.4.0
|
00001 00018 #ifndef _DECAF_LANG_MATH_H_ 00019 #define _DECAF_LANG_MATH_H_ 00020 00021 #include <decaf/util/Config.h> 00022 00023 // On some systems there is a min and max macro defined. 00024 #undef min 00025 #undef max 00026 00027 namespace decaf{ 00028 namespace lang{ 00029 00035 class DECAF_API Math { 00036 public: 00037 00038 static const double E; 00039 static const double PI; 00040 00041 public: 00042 00043 Math() {} 00044 virtual ~Math() {} 00045 00046 public: 00047 00055 static int abs( int value ) { 00056 return value < 0 ? -value : value; 00057 } 00058 00066 static long long abs( long long value ) { 00067 return value < 0 ? -value : value; 00068 } 00069 00086 static float abs( float value ); 00087 00105 static double abs( double value ); 00106 00117 //static double acos( double value ); 00118 00131 //static double asin( double value ); 00132 00144 //static double atan( double value ); 00145 00188 //static double atan2( double x, double y ); 00189 00204 //static double cbrt( double value ); 00205 00214 //static double cos( double value ); 00215 00228 //static double cosh( double value ); 00229 00240 //static double sin( double value ); 00241 00256 //static double sinh( double value ); 00257 00268 //static double tan( double value ); 00269 00285 //static double tanh( double value ); 00286 00301 static double sqrt( double value ); 00302 00319 static double pow( double base, double exp ); 00320 00335 //static double rint( double value ); 00336 00346 static short min( short a, short b ) { 00347 return ( a <= b ? a : b ); 00348 } 00349 00359 static int min( int a, int b ) { 00360 return ( a <= b ? a : b ); 00361 } 00362 00372 static unsigned int min( unsigned int a, unsigned int b ) { 00373 return ( a <= b ? a : b ); 00374 } 00375 00385 static long long min( long long a, long long b ) { 00386 return ( a <= b ? a : b ); 00387 } 00388 00401 static float min( float a, float b ); 00402 00415 static double min( double a, double b ); 00416 00426 static short max( short a, short b ) { 00427 return ( a >= b ? a : b ); 00428 } 00429 00439 static int max( int a, int b ) { 00440 return ( a >= b ? a : b ); 00441 } 00442 00452 static long long max( long long a, long long b ) { 00453 return ( a >= b ? a : b ); 00454 } 00455 00468 static float max( float a, float b ); 00469 00481 static double max( double a, double b ); 00482 00495 //static double log( double value ); 00496 00510 //static double log10( double value ); 00511 00529 //static double log1p( double value ); 00530 00549 static double ceil( double value ); 00550 00566 static double floor( double value ); 00567 00585 static int round( float value ); 00586 00604 static long long round( double value ); 00605 00625 //static double IEEEremainder( double f1, double f2 ); 00626 00643 static double random(); 00644 00656 //static double exp( double value ); 00657 00672 //static double expm1( double value ); 00673 00686 //static double hypot( double x, double y ); 00687 00700 static float signum( float value ); 00701 00714 static double signum( double value ); 00715 00721 static double toRadians( double angdeg ) { 00722 return angdeg / 180 * PI; 00723 } 00724 00730 static double toDegrees( double angrad ) { 00731 return angrad * 180 / PI; 00732 } 00733 00750 //static float ulp( float value ); 00751 00768 //static double ulp( double value ); 00769 00770 }; 00771 00772 }} 00773 00774 #endif /*_DECAF_LANG_MATH_H_*/