1 //
2 // corecrt_math_defines.h
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // Definitions of useful mathematical constants
7 //
8 #pragma once
9 #ifndef _MATH_DEFINES_DEFINED
10 #define _MATH_DEFINES_DEFINED
11 
12 #include <corecrt.h>
13 
14 #pragma warning(push)
15 #pragma warning(disable: _UCRT_DISABLED_WARNINGS)
16 _UCRT_DISABLE_CLANG_WARNINGS
17 
18 // Definitions of useful mathematical constants
19 //
20 // Define _USE_MATH_DEFINES before including <math.h> to expose these macro
21 // definitions for common math constants.  These are placed under an #ifdef
22 // since these commonly-defined names are not part of the C or C++ standards
23 #define M_E        2.71828182845904523536   // e
24 #define M_LOG2E    1.44269504088896340736   // log2(e)
25 #define M_LOG10E   0.434294481903251827651  // log10(e)
26 #define M_LN2      0.693147180559945309417  // ln(2)
27 #define M_LN10     2.30258509299404568402   // ln(10)
28 #define M_PI       3.14159265358979323846   // pi
29 #define M_PI_2     1.57079632679489661923   // pi/2
30 #define M_PI_4     0.785398163397448309616  // pi/4
31 #define M_1_PI     0.318309886183790671538  // 1/pi
32 #define M_2_PI     0.636619772367581343076  // 2/pi
33 #define M_2_SQRTPI 1.12837916709551257390   // 2/sqrt(pi)
34 #define M_SQRT2    1.41421356237309504880   // sqrt(2)
35 #define M_SQRT1_2  0.707106781186547524401  // 1/sqrt(2)
36 
37 _UCRT_RESTORE_CLANG_WARNINGS
38 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS
39 #endif // _MATH_DEFINES_DEFINED
40