DotNetDupe 5.0.4
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
Math.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "Common.h"
10
11namespace DotNetDupe {
12 namespace System {
13
19 class Math {
20 public:
22 static constexpr double E = 2.71828182845904523536;
23
25 static constexpr double PI = 3.14159265358979323846;
26
28 static constexpr double Tau = 6.28318530717958647692;
29
31 DOTNETDUPE_API static int Abs(int iValue);
32
34 DOTNETDUPE_API static long long Abs(long long llValue);
35
37 DOTNETDUPE_API static float Abs(float fValue);
38
40 DOTNETDUPE_API static double Abs(double dValue);
41
43 DOTNETDUPE_API static int Max(int iVal1, int iVal2);
44
46 DOTNETDUPE_API static long long Max(long long llVal1, long long llVal2);
47
49 DOTNETDUPE_API static float Max(float fVal1, float fVal2);
50
52 DOTNETDUPE_API static double Max(double dVal1, double dVal2);
53
55 DOTNETDUPE_API static int Min(int iVal1, int iVal2);
56
58 DOTNETDUPE_API static long long Min(long long llVal1, long long llVal2);
59
61 DOTNETDUPE_API static float Min(float fVal1, float fVal2);
62
64 DOTNETDUPE_API static double Min(double dVal1, double dVal2);
65
67 DOTNETDUPE_API static int Clamp(int iValue, int iMin, int iMax);
68
70 DOTNETDUPE_API static long long Clamp(long long llValue, long long llMin, long long llMax);
71
73 DOTNETDUPE_API static double Clamp(double dValue, double dMin, double dMax);
74
76 DOTNETDUPE_API static int Sign(int iValue);
77
79 DOTNETDUPE_API static int Sign(long long llValue);
80
82 DOTNETDUPE_API static int Sign(double dValue);
83
85 DOTNETDUPE_API static double Floor(double dValue);
86
88 DOTNETDUPE_API static double Ceiling(double dValue);
89
91 DOTNETDUPE_API static double Round(double dValue);
92
94 DOTNETDUPE_API static double Round(double dValue, int iDigits);
95
97 DOTNETDUPE_API static double Truncate(double dValue);
98
100 DOTNETDUPE_API static double Sqrt(double dValue);
101
103 DOTNETDUPE_API static double Cbrt(double dValue);
104
106 DOTNETDUPE_API static double Pow(double dBase, double dExponent);
107
109 DOTNETDUPE_API static double Exp(double dValue);
110
112 DOTNETDUPE_API static double Log(double dValue);
113
115 DOTNETDUPE_API static double Log(double dValue, double dNewBase);
116
118 DOTNETDUPE_API static double Log10(double dValue);
119
121 DOTNETDUPE_API static double Log2(double dValue);
122
124 DOTNETDUPE_API static double Sin(double dValue);
125
127 DOTNETDUPE_API static double Cos(double dValue);
128
130 DOTNETDUPE_API static double Tan(double dValue);
131
133 DOTNETDUPE_API static double Asin(double dValue);
134
136 DOTNETDUPE_API static double Acos(double dValue);
137
139 DOTNETDUPE_API static double Atan(double dValue);
140
142 DOTNETDUPE_API static double Atan2(double dY, double dX);
143
145 DOTNETDUPE_API static double Sinh(double dValue);
146
148 DOTNETDUPE_API static double Cosh(double dValue);
149
151 DOTNETDUPE_API static double Tanh(double dValue);
152
154 DOTNETDUPE_API static double Mean(const Collections::Generic::List<double>& listValues);
155
157 DOTNETDUPE_API static double Variance(const Collections::Generic::List<double>& listValues, bool bIsSample = false);
158
160 DOTNETDUPE_API static double StandardDeviation(const Collections::Generic::List<double>& listValues, bool bIsSample = false);
161
163 DOTNETDUPE_API static double StdDev(const Collections::Generic::List<double>& listValues, bool bIsSample = false);
164
166 DOTNETDUPE_API static double MovingAverage(const Collections::Generic::List<double>& listValues, int iPeriod);
167
170
172 DOTNETDUPE_API static double ExponentialMovingAverage(const Collections::Generic::List<double>& listValues, int iPeriod, double dSmoothing = 2.0);
173
176 };
177
178 }
179}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Represents a strongly typed list of objects that can be accessed by index mirroring ....
Represents a strongly typed list of objects accessible by index.
Definition List.h:31
Provides constants and static methods for trigonometric, logarithmic, and statistical functions.
Definition Math.h:19
static double Cos(double dValue)
Returns the cosine of the specified angle.
Definition Math.cpp:188
static double Floor(double dValue)
Returns the largest integral value less than or equal to the specified number.
Definition Math.cpp:115
static double Log2(double dValue)
Returns the base 2 logarithm of a specified number.
Definition Math.cpp:178
static double Round(double dValue)
Rounds a double-precision floating-point value to the nearest integral value.
Definition Math.cpp:125
static double Exp(double dValue)
Returns e raised to the specified power.
Definition Math.cpp:157
static double Sin(double dValue)
Returns the sine of the specified angle.
Definition Math.cpp:183
static double Mean(const Collections::Generic::List< double > &listValues)
Computes the arithmetic mean of a sequence of double values.
static Collections::Generic::List< double > ExponentialMovingAverageSeries(const Collections::Generic::List< double > &listValues, int iPeriod, double dSmoothing=2.0)
Computes the rolling exponential moving average (EMA) series across the sequence.
static int Clamp(int iValue, int iMin, int iMax)
Returns a value clamped to the inclusive range of min and max.
Definition Math.cpp:70
static constexpr double Tau
Represents the number of radians in one turn, specified by the constant tau (2*pi).
Definition Math.h:28
static double Asin(double dValue)
Returns the angle whose sine is the specified number.
Definition Math.cpp:198
static constexpr double E
Represents the natural logarithmic base, specified by the constant e.
Definition Math.h:22
static double Variance(const Collections::Generic::List< double > &listValues, bool bIsSample=false)
Computes the variance of a sequence of double values.
static int Sign(int iValue)
Returns an integer that indicates the sign of a 32-bit signed integer.
Definition Math.cpp:94
static double Acos(double dValue)
Returns the angle whose cosine is the specified number.
Definition Math.cpp:203
static int Min(int iVal1, int iVal2)
Returns the smaller of two 32-bit signed integers.
Definition Math.cpp:50
static constexpr double PI
Represents the ratio of the circumference of a circle to its diameter, specified by the constant pi.
Definition Math.h:25
static double StandardDeviation(const Collections::Generic::List< double > &listValues, bool bIsSample=false)
Computes the standard deviation of a sequence of double values.
static double StdDev(const Collections::Generic::List< double > &listValues, bool bIsSample=false)
Computes the standard deviation of a sequence of double values (abbreviated alias).
static double Tan(double dValue)
Returns the tangent of the specified angle.
Definition Math.cpp:193
static double Log(double dValue)
Returns the natural (base e) logarithm of a specified number.
Definition Math.cpp:162
static double MovingAverage(const Collections::Generic::List< double > &listValues, int iPeriod)
Computes the simple moving average (SMA) over the final window of length iPeriod.
static int Max(int iVal1, int iVal2)
Returns the larger of two 32-bit signed integers.
Definition Math.cpp:30
static double Truncate(double dValue)
Calculates the integral part of a specified double-precision floating-point number.
Definition Math.cpp:137
static double Cbrt(double dValue)
Returns the cube root of a specified number.
Definition Math.cpp:147
static Collections::Generic::List< double > MovingAverageSeries(const Collections::Generic::List< double > &listValues, int iPeriod)
Computes the rolling simple moving average (SMA) series across all values.
static double Ceiling(double dValue)
Returns the smallest integral value that is greater than or equal to the specified number.
Definition Math.cpp:120
static double Log10(double dValue)
Returns the base 10 logarithm of a specified number.
Definition Math.cpp:173
static double Sqrt(double dValue)
Returns the square root of a specified number.
Definition Math.cpp:142
static double Pow(double dBase, double dExponent)
Returns a specified number raised to the specified power.
Definition Math.cpp:152
static double ExponentialMovingAverage(const Collections::Generic::List< double > &listValues, int iPeriod, double dSmoothing=2.0)
Computes the exponential moving average (EMA) value for the sequence.
static double Cosh(double dValue)
Returns the hyperbolic cosine of the specified angle.
Definition Math.cpp:223
static double Sinh(double dValue)
Returns the hyperbolic sine of the specified angle.
Definition Math.cpp:218
static double Atan2(double dY, double dX)
Returns the angle whose tangent is the quotient of two specified numbers.
Definition Math.cpp:213
static double Atan(double dValue)
Returns the angle whose tangent is the specified number.
Definition Math.cpp:208
static int Abs(int iValue)
Returns the absolute value of a 32-bit signed integer.
Definition Math.cpp:10
static double Tanh(double dValue)
Returns the hyperbolic tangent of the specified angle.
Definition Math.cpp:228