| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# cbrt.h

Go to the documentation of this file.

    00001 // $Id: cbrt.h,v 1.1 2007/07/27 12:59:52 marcocle Exp $
    00002 #ifndef GAUDIKERNEL_CBRT_H
    00003 #define GAUDIKERNEL_CBRT_H
    00004
    00005 // ============================================================================
    00006 // Include files
    00007 // ============================================================================
    00008
    00009 #include <cmath>
    00010
    00020 // double cbrt(double) is a gcc built-in
    00021 #ifndef __GNUC__
    00022 inline double cbrt( double __x ){
    00023   return ::pow( __x, static_cast<double>(1.0/3.0) );
    00024 }
    00025 #endif
    00026
    00027 // we need cbrtf for floats
    00028 inline float cbrt( float __x ) {
    00029 #ifdef __GNUC__
    00030   return ::cbrtf( __x );
    00031 #else
    00032   return ::pow( __x, static_cast<float>(1.0/3.0) );
    00033 #endif
    00034 }
    00035
    00036 // we need cbrtl for long doubles
    00037 inline long double cbrt( long double __x ) {
    00038 #ifdef __GNUC__
    00039   return ::cbrtl( __x );
    00040 #else
    00041   return ::pow( __x, static_cast<long double>(1.0/3.0) );
    00042 #endif
    00043 }
    00044
    00045 // use cbrt(double) for integers
    00046 #define cbrt_for_int_type(t) \
    00047 inline double cbrt( t __x ) { return cbrt ( static_cast<double>(__x) ); }
    00048
    00049 cbrt_for_int_type(int)
    00050 cbrt_for_int_type(long)
    00051 cbrt_for_int_type(long long)
    00052 cbrt_for_int_type(unsigned int)
    00053 cbrt_for_int_type(unsigned long)
    00054 cbrt_for_int_type(unsigned long long)
    00055
    00056 #undef cbrt_for_int_type
    00057
    00058 #endif
    00059 // ============================================================================