HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SYS_MathCbrt.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SYS_MathCbrt.h (SYS Library, C++)
7  *
8  * COMMENTS: This is taken out of SYS_Math.h to avoid including > 1200 boost
9  * header files.
10  */
11 
12 #ifndef __SYS_MATHCBRT_H_INCLUDED__
13 #define __SYS_MATHCBRT_H_INCLUDED__
14 
15 #include "SYS_API.h"
16 
17 #include "SYS_Types.h"
18 #include <hboost/math/special_functions/cbrt.hpp>
19 #include <hboost/math/policies/policy.hpp>
20 
21 // This policy is used instead of the default error-handling policy for
22 // the cube root function SYScbrt.
23 // This is needed to ensure that no exceptions are thrown.
24 namespace SYS_MathCBRT
25 {
27  hboost::math::policies::domain_error<hboost::math::policies::ignore_error>,
28  hboost::math::policies::pole_error<hboost::math::policies::ignore_error>,
29  hboost::math::policies::overflow_error<hboost::math::policies::ignore_error>,
30  hboost::math::policies::underflow_error<hboost::math::policies::ignore_error>,
31  hboost::math::policies::denorm_error<hboost::math::policies::ignore_error>,
32  hboost::math::policies::rounding_error<hboost::math::policies::ignore_error>,
33  hboost::math::policies::evaluation_error<hboost::math::policies::ignore_error>,
34  hboost::math::policies::indeterminate_result_error<hboost::math::policies::ignore_error>
35  > policy;
36 }
37 
38 // Use the same cbrt() implementation on all platforms, and never use
39 // pow(x,1.0/3.0)!
40 static inline fpreal32 SYScbrt(fpreal32 a)
41  { return hboost::math::cbrt(a, SYS_MathCBRT::policy()); }
42 static inline fpreal64 SYScbrt(fpreal64 a)
43  { return hboost::math::cbrt(a, SYS_MathCBRT::policy()); }
44 static inline fpreal64 SYScbrt(int32 a)
45  { return hboost::math::cbrt(fpreal64(a), SYS_MathCBRT::policy()); }
46 static inline fpreal64 SYScbrt(int64 a)
47  { return hboost::math::cbrt(fpreal64(a), SYS_MathCBRT::policy()); }
48 
49 
50 #endif // __SYS_MATHCBRT_H_INCLUDED__
hboost::math::policies::policy< hboost::math::policies::domain_error< hboost::math::policies::ignore_error >, hboost::math::policies::pole_error< hboost::math::policies::ignore_error >, hboost::math::policies::overflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::underflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::denorm_error< hboost::math::policies::ignore_error >, hboost::math::policies::rounding_error< hboost::math::policies::ignore_error >, hboost::math::policies::evaluation_error< hboost::math::policies::ignore_error >, hboost::math::policies::indeterminate_result_error< hboost::math::policies::ignore_error > > policy
Definition: SYS_MathCbrt.h:35
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
long long int64
Definition: SYS_Types.h:106
double fpreal64
Definition: SYS_Types.h:191
int int32
Definition: SYS_Types.h:34
float fpreal32
Definition: SYS_Types.h:190