xref: /aosp_15_r20/external/pytorch/c10/util/MathConstants.cpp (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1*da0073e9SAndroid Build Coastguard Worker // define constants like M_PI and C keywords for MSVC
2*da0073e9SAndroid Build Coastguard Worker #ifdef _MSC_VER
3*da0073e9SAndroid Build Coastguard Worker #ifndef _USE_MATH_DEFINES
4*da0073e9SAndroid Build Coastguard Worker #define _USE_MATH_DEFINES
5*da0073e9SAndroid Build Coastguard Worker #endif
6*da0073e9SAndroid Build Coastguard Worker #endif
7*da0073e9SAndroid Build Coastguard Worker 
8*da0073e9SAndroid Build Coastguard Worker #include <c10/util/MathConstants.h>
9*da0073e9SAndroid Build Coastguard Worker 
10*da0073e9SAndroid Build Coastguard Worker // NOLINTNEXTLINE(modernize-deprecated-headers)
11*da0073e9SAndroid Build Coastguard Worker #include <math.h>
12*da0073e9SAndroid Build Coastguard Worker 
13*da0073e9SAndroid Build Coastguard Worker static_assert(M_PI == c10::pi<double>, "c10::pi<double> must be equal to M_PI");
14*da0073e9SAndroid Build Coastguard Worker static_assert(
15*da0073e9SAndroid Build Coastguard Worker     M_SQRT1_2 == c10::frac_sqrt_2<double>,
16*da0073e9SAndroid Build Coastguard Worker     "c10::frac_sqrt_2<double> must be equal to M_SQRT1_2");
17