| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cbrt.h
Go to the documentation of this file.
1 // $Id: cbrt.h,v 1.1 2007/07/27 12:59:52 marcocle Exp $
2 #ifndef GAUDIKERNEL_CBRT_H
3 #define GAUDIKERNEL_CBRT_H
4
5 // ============================================================================
6 // Include files
7 // ============================================================================
8
9 #include <cmath>
10
20 // double cbrt(double) is a gcc built-in
21 #ifndef __GNUC__
22 inline double cbrt( double __x ){
23 return ::pow( __x, static_cast<double>(1.0/3.0) );
24 }
25 #endif
26
27 // we need cbrtf for floats
28 inline float cbrt( float __x ) {
29 #ifdef __GNUC__
30 return ::cbrtf( __x );
31 #else
32 return ::pow( __x, static_cast<float>(1.0/3.0) );
33 #endif
34 }
35
36 // we need cbrtl for long doubles
37 inline long double cbrt( long double __x ) {
38 #ifdef __GNUC__
39 return ::cbrtl( __x );
40 #else
41 return ::pow( __x, static_cast<long double>(1.0/3.0) );
42 #endif
43 }
44
45 #ifdef __INTEL_COMPILER // Disable ICC remark
46 #pragma warning(push)
47 #pragma warning(disable:2259) // non-pointer conversion may lose significant bits
48 #endif
49
50 // use cbrt(double) for integers
51 #define cbrt_for_int_type(t) \
52 inline double cbrt( t __x ) { return cbrt ( static_cast<double>(__x) ); }
53
54 cbrt_for_int_type(int)
55 cbrt_for_int_type(long)
56 cbrt_for_int_type(long long)
57 cbrt_for_int_type(unsigned int)
58 cbrt_for_int_type(unsigned long)
59 cbrt_for_int_type(unsigned long long)
60
61 #ifdef __INTEL_COMPILER // End disable ICC remark
62 #pragma warning(pop)
63 #endif
64
65 #undef cbrt_for_int_type
66
67 #endif
68 // ============================================================================