| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

# 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 #ifdef __INTEL_COMPILER        // Disable ICC remark
    00046   #pragma warning(push)
    00047   #pragma warning(disable:2259) // non-pointer conversion may lose significant bits
    00048 #endif
    00049
    00050 // use cbrt(double) for integers
    00051 #define cbrt_for_int_type(t) \
    00052 inline double cbrt( t __x ) { return cbrt ( static_cast<double>(__x) ); }
    00053
    00054 cbrt_for_int_type(int)
    00055 cbrt_for_int_type(long)
    00056 cbrt_for_int_type(long long)
    00057 cbrt_for_int_type(unsigned int)
    00058 cbrt_for_int_type(unsigned long)
    00059 cbrt_for_int_type(unsigned long long)
    00060
    00061 #ifdef __INTEL_COMPILER        // End disable ICC remark
    00062   #pragma warning(pop)
    00063 #endif
    00064
    00065 #undef cbrt_for_int_type
    00066
    00067 #endif
    00068 // ============================================================================

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines