DotNetDupe 5.0.4
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
DotNetDupe::System::Math Class Reference

Provides constants and static methods for trigonometric, logarithmic, and statistical functions. More...

#include <Math.h>

Static Public Member Functions

static double Abs (double dValue)
 Returns the absolute value of a double-precision floating-point number.
static float Abs (float fValue)
 Returns the absolute value of a single-precision floating-point number.
static int Abs (int iValue)
 Returns the absolute value of a 32-bit signed integer.
static long long Abs (long long llValue)
 Returns the absolute value of a 64-bit signed integer.
static double Acos (double dValue)
 Returns the angle whose cosine is the specified number.
static double Asin (double dValue)
 Returns the angle whose sine is the specified number.
static double Atan (double dValue)
 Returns the angle whose tangent is the specified number.
static double Atan2 (double dY, double dX)
 Returns the angle whose tangent is the quotient of two specified numbers.
static double Cbrt (double dValue)
 Returns the cube root of a specified number.
static double Ceiling (double dValue)
 Returns the smallest integral value that is greater than or equal to the specified number.
static double Clamp (double dValue, double dMin, double dMax)
 Returns a value clamped to the inclusive range of min and max.
static int Clamp (int iValue, int iMin, int iMax)
 Returns a value clamped to the inclusive range of min and max.
static long long Clamp (long long llValue, long long llMin, long long llMax)
 Returns a value clamped to the inclusive range of min and max.
static double Cos (double dValue)
 Returns the cosine of the specified angle.
static double Cosh (double dValue)
 Returns the hyperbolic cosine of the specified angle.
static double Exp (double dValue)
 Returns e raised to the specified power.
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 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 double Floor (double dValue)
 Returns the largest integral value less than or equal to the specified number.
static double Log (double dValue)
 Returns the natural (base e) logarithm of a specified number.
static double Log (double dValue, double dNewBase)
 Returns the logarithm of a specified number in a specified base.
static double Log10 (double dValue)
 Returns the base 10 logarithm of a specified number.
static double Log2 (double dValue)
 Returns the base 2 logarithm of a specified number.
static double Max (double dVal1, double dVal2)
 Returns the larger of two double-precision floating-point numbers.
static float Max (float fVal1, float fVal2)
 Returns the larger of two single-precision floating-point numbers.
static int Max (int iVal1, int iVal2)
 Returns the larger of two 32-bit signed integers.
static long long Max (long long llVal1, long long llVal2)
 Returns the larger of two 64-bit signed integers.
static double Mean (const Collections::Generic::List< double > &listValues)
 Computes the arithmetic mean of a sequence of double values.
static double Min (double dVal1, double dVal2)
 Returns the smaller of two double-precision floating-point numbers.
static float Min (float fVal1, float fVal2)
 Returns the smaller of two single-precision floating-point numbers.
static int Min (int iVal1, int iVal2)
 Returns the smaller of two 32-bit signed integers.
static long long Min (long long llVal1, long long llVal2)
 Returns the smaller of two 64-bit signed integers.
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 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 Pow (double dBase, double dExponent)
 Returns a specified number raised to the specified power.
static double Round (double dValue)
 Rounds a double-precision floating-point value to the nearest integral value.
static double Round (double dValue, int iDigits)
 Rounds a double-precision floating-point value to a specified number of fractional digits.
static int Sign (double dValue)
 Returns an integer that indicates the sign of a double-precision floating-point number.
static int Sign (int iValue)
 Returns an integer that indicates the sign of a 32-bit signed integer.
static int Sign (long long llValue)
 Returns an integer that indicates the sign of a 64-bit signed integer.
static double Sin (double dValue)
 Returns the sine of the specified angle.
static double Sinh (double dValue)
 Returns the hyperbolic sine of the specified angle.
static double Sqrt (double dValue)
 Returns the square root of a specified number.
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.
static double Tanh (double dValue)
 Returns the hyperbolic tangent of the specified angle.
static double Truncate (double dValue)
 Calculates the integral part of a specified double-precision floating-point number.
static double Variance (const Collections::Generic::List< double > &listValues, bool bIsSample=false)
 Computes the variance of a sequence of double values.

Static Public Attributes

static constexpr double E = 2.71828182845904523536
 Represents the natural logarithmic base, specified by the constant e.
static constexpr double PI = 3.14159265358979323846
 Represents the ratio of the circumference of a circle to its diameter, specified by the constant pi.
static constexpr double Tau = 6.28318530717958647692
 Represents the number of radians in one turn, specified by the constant tau (2*pi).

Detailed Description

Provides constants and static methods for trigonometric, logarithmic, and statistical functions.

Implements IEEE 754 standard mathematical primitives and high-order time-series statistics with zero STL leakage and standard DotNetDupe memory safety guarantees.

Definition at line 19 of file Math.h.

Member Function Documentation

◆ Abs() [1/4]

double DotNetDupe::System::Math::Abs ( double dValue)
static

Returns the absolute value of a double-precision floating-point number.

Return: Absolute value of double-precision float.

Definition at line 25 of file Math.cpp.

◆ Abs() [2/4]

float DotNetDupe::System::Math::Abs ( float fValue)
static

Returns the absolute value of a single-precision floating-point number.

Return: Absolute value of single-precision float.

Definition at line 20 of file Math.cpp.

◆ Abs() [3/4]

int DotNetDupe::System::Math::Abs ( int iValue)
static

Returns the absolute value of a 32-bit signed integer.

Return: Absolute value of 32-bit signed integer.

Definition at line 10 of file Math.cpp.

◆ Abs() [4/4]

long long DotNetDupe::System::Math::Abs ( long long llValue)
static

Returns the absolute value of a 64-bit signed integer.

Return: Absolute value of 64-bit signed integer.

Definition at line 15 of file Math.cpp.

◆ Acos()

double DotNetDupe::System::Math::Acos ( double dValue)
static

Returns the angle whose cosine is the specified number.

Return: Arc cosine.

Definition at line 203 of file Math.cpp.

◆ Asin()

double DotNetDupe::System::Math::Asin ( double dValue)
static

Returns the angle whose sine is the specified number.

Return: Arc sine.

Definition at line 198 of file Math.cpp.

◆ Atan()

double DotNetDupe::System::Math::Atan ( double dValue)
static

Returns the angle whose tangent is the specified number.

Return: Arc tangent.

Definition at line 208 of file Math.cpp.

◆ Atan2()

double DotNetDupe::System::Math::Atan2 ( double dY,
double dX )
static

Returns the angle whose tangent is the quotient of two specified numbers.

Return: Four-quadrant arc tangent.

Definition at line 213 of file Math.cpp.

◆ Cbrt()

double DotNetDupe::System::Math::Cbrt ( double dValue)
static

Returns the cube root of a specified number.

Return: Cube root of value.

Definition at line 147 of file Math.cpp.

◆ Ceiling()

double DotNetDupe::System::Math::Ceiling ( double dValue)
static

Returns the smallest integral value that is greater than or equal to the specified number.

Return: Smallest integer greater than or equal to value.

Definition at line 120 of file Math.cpp.

◆ Clamp() [1/3]

double DotNetDupe::System::Math::Clamp ( double dValue,
double dMin,
double dMax )
static

Returns a value clamped to the inclusive range of min and max.

Guard: Validate range boundaries.

Definition at line 86 of file Math.cpp.

References DotNetDupe::System::ArgumentException::ArgumentException().

◆ Clamp() [2/3]

int DotNetDupe::System::Math::Clamp ( int iValue,
int iMin,
int iMax )
static

Returns a value clamped to the inclusive range of min and max.

Guard: Validate range boundaries.

Definition at line 70 of file Math.cpp.

References DotNetDupe::System::ArgumentException::ArgumentException().

◆ Clamp() [3/3]

long long DotNetDupe::System::Math::Clamp ( long long llValue,
long long llMin,
long long llMax )
static

Returns a value clamped to the inclusive range of min and max.

Guard: Validate range boundaries.

Definition at line 78 of file Math.cpp.

References DotNetDupe::System::ArgumentException::ArgumentException().

◆ Cos()

double DotNetDupe::System::Math::Cos ( double dValue)
static

Returns the cosine of the specified angle.

Return: Cosine of angle.

Definition at line 188 of file Math.cpp.

◆ Cosh()

double DotNetDupe::System::Math::Cosh ( double dValue)
static

Returns the hyperbolic cosine of the specified angle.

Return: Hyperbolic cosine.

Definition at line 223 of file Math.cpp.

◆ Exp()

double DotNetDupe::System::Math::Exp ( double dValue)
static

Returns e raised to the specified power.

Return: e raised to power.

Definition at line 157 of file Math.cpp.

◆ ExponentialMovingAverage()

double DotNetDupe::System::Math::ExponentialMovingAverage ( const Collections::Generic::List< double > & listValues,
int iPeriod,
double dSmoothing = 2.0 )
static

◆ ExponentialMovingAverageSeries()

Collections::Generic::List< double > DotNetDupe::System::Math::ExponentialMovingAverageSeries ( const Collections::Generic::List< double > & listValues,
int iPeriod,
double dSmoothing = 2.0 )
static

◆ Floor()

double DotNetDupe::System::Math::Floor ( double dValue)
static

Returns the largest integral value less than or equal to the specified number.

Return: Largest integer less than or equal to value.

Definition at line 115 of file Math.cpp.

◆ Log() [1/2]

double DotNetDupe::System::Math::Log ( double dValue)
static

Returns the natural (base e) logarithm of a specified number.

Return: Natural logarithm.

Definition at line 162 of file Math.cpp.

◆ Log() [2/2]

double DotNetDupe::System::Math::Log ( double dValue,
double dNewBase )
static

Returns the logarithm of a specified number in a specified base.

Guard: Validate logarithm base.

Definition at line 167 of file Math.cpp.

References DotNetDupe::System::ArgumentException::ArgumentException().

◆ Log10()

double DotNetDupe::System::Math::Log10 ( double dValue)
static

Returns the base 10 logarithm of a specified number.

Return: Base 10 logarithm.

Definition at line 173 of file Math.cpp.

◆ Log2()

double DotNetDupe::System::Math::Log2 ( double dValue)
static

Returns the base 2 logarithm of a specified number.

Return: Base 2 logarithm.

Definition at line 178 of file Math.cpp.

◆ Max() [1/4]

double DotNetDupe::System::Math::Max ( double dVal1,
double dVal2 )
static

Returns the larger of two double-precision floating-point numbers.

Return: Maximum of two double-precision floats.

Definition at line 45 of file Math.cpp.

◆ Max() [2/4]

float DotNetDupe::System::Math::Max ( float fVal1,
float fVal2 )
static

Returns the larger of two single-precision floating-point numbers.

Return: Maximum of two single-precision floats.

Definition at line 40 of file Math.cpp.

◆ Max() [3/4]

int DotNetDupe::System::Math::Max ( int iVal1,
int iVal2 )
static

Returns the larger of two 32-bit signed integers.

Return: Maximum of two 32-bit integers.

Definition at line 30 of file Math.cpp.

◆ Max() [4/4]

long long DotNetDupe::System::Math::Max ( long long llVal1,
long long llVal2 )
static

Returns the larger of two 64-bit signed integers.

Return: Maximum of two 64-bit integers.

Definition at line 35 of file Math.cpp.

◆ Mean()

double DotNetDupe::System::Math::Mean ( const Collections::Generic::List< double > & listValues)
static

Computes the arithmetic mean of a sequence of double values.

Guard: Ensure list is not empty.

Definition at line 10 of file MathStatistics.cpp.

References DotNetDupe::System::ArgumentException::ArgumentException(), and DotNetDupe::System::Collections::Generic::List< T >::GetCount().

Referenced by DotNetDupe::System::Numerics::Statistics::Mean(), and Variance().

◆ Min() [1/4]

double DotNetDupe::System::Math::Min ( double dVal1,
double dVal2 )
static

Returns the smaller of two double-precision floating-point numbers.

Return: Minimum of two double-precision floats.

Definition at line 65 of file Math.cpp.

◆ Min() [2/4]

float DotNetDupe::System::Math::Min ( float fVal1,
float fVal2 )
static

Returns the smaller of two single-precision floating-point numbers.

Return: Minimum of two single-precision floats.

Definition at line 60 of file Math.cpp.

◆ Min() [3/4]

int DotNetDupe::System::Math::Min ( int iVal1,
int iVal2 )
static

Returns the smaller of two 32-bit signed integers.

Return: Minimum of two 32-bit integers.

Definition at line 50 of file Math.cpp.

◆ Min() [4/4]

long long DotNetDupe::System::Math::Min ( long long llVal1,
long long llVal2 )
static

Returns the smaller of two 64-bit signed integers.

Return: Minimum of two 64-bit integers.

Definition at line 55 of file Math.cpp.

◆ MovingAverage()

double DotNetDupe::System::Math::MovingAverage ( const Collections::Generic::List< double > & listValues,
int iPeriod )
static

Computes the simple moving average (SMA) over the final window of length iPeriod.

Guard: Validate period range and item count.

Definition at line 46 of file MathStatistics.cpp.

References DotNetDupe::System::ArgumentException::ArgumentException(), DotNetDupe::System::ArgumentOutOfRangeException::ArgumentOutOfRangeException(), and DotNetDupe::System::Collections::Generic::List< T >::GetCount().

Referenced by DotNetDupe::System::Numerics::Statistics::MovingAverage().

◆ MovingAverageSeries()

Collections::Generic::List< double > DotNetDupe::System::Math::MovingAverageSeries ( const Collections::Generic::List< double > & listValues,
int iPeriod )
static

◆ Pow()

double DotNetDupe::System::Math::Pow ( double dBase,
double dExponent )
static

Returns a specified number raised to the specified power.

Return: Value raised to exponent.

Definition at line 152 of file Math.cpp.

◆ Round() [1/2]

double DotNetDupe::System::Math::Round ( double dValue)
static

Rounds a double-precision floating-point value to the nearest integral value.

Return: Round to nearest integral value.

Definition at line 125 of file Math.cpp.

◆ Round() [2/2]

double DotNetDupe::System::Math::Round ( double dValue,
int iDigits )
static

Rounds a double-precision floating-point value to a specified number of fractional digits.

Guard: Validate digits parameter.

Definition at line 130 of file Math.cpp.

References DotNetDupe::System::ArgumentOutOfRangeException::ArgumentOutOfRangeException().

◆ Sign() [1/3]

int DotNetDupe::System::Math::Sign ( double dValue)
static

Returns an integer that indicates the sign of a double-precision floating-point number.

Return: Sign of double-precision float.

Definition at line 108 of file Math.cpp.

◆ Sign() [2/3]

int DotNetDupe::System::Math::Sign ( int iValue)
static

Returns an integer that indicates the sign of a 32-bit signed integer.

Return: Sign of 32-bit integer.

Definition at line 94 of file Math.cpp.

◆ Sign() [3/3]

int DotNetDupe::System::Math::Sign ( long long llValue)
static

Returns an integer that indicates the sign of a 64-bit signed integer.

Return: Sign of 64-bit integer.

Definition at line 101 of file Math.cpp.

◆ Sin()

double DotNetDupe::System::Math::Sin ( double dValue)
static

Returns the sine of the specified angle.

Return: Sine of angle.

Definition at line 183 of file Math.cpp.

◆ Sinh()

double DotNetDupe::System::Math::Sinh ( double dValue)
static

Returns the hyperbolic sine of the specified angle.

Return: Hyperbolic sine.

Definition at line 218 of file Math.cpp.

◆ Sqrt()

double DotNetDupe::System::Math::Sqrt ( double dValue)
static

Returns the square root of a specified number.

Return: Square root of value.

Definition at line 142 of file Math.cpp.

◆ StandardDeviation()

double DotNetDupe::System::Math::StandardDeviation ( const Collections::Generic::List< double > & listValues,
bool bIsSample = false )
static

Computes the standard deviation of a sequence of double values.

Return: Square root of variance.

Definition at line 36 of file MathStatistics.cpp.

References Variance().

Referenced by DotNetDupe::System::Numerics::Statistics::StandardDeviation(), and StdDev().

◆ StdDev()

double DotNetDupe::System::Math::StdDev ( const Collections::Generic::List< double > & listValues,
bool bIsSample = false )
static

Computes the standard deviation of a sequence of double values (abbreviated alias).

Forward: Delegate to StandardDeviation.

Definition at line 41 of file MathStatistics.cpp.

References StandardDeviation().

Referenced by DotNetDupe::System::Numerics::Statistics::StdDev().

◆ Tan()

double DotNetDupe::System::Math::Tan ( double dValue)
static

Returns the tangent of the specified angle.

Return: Tangent of angle.

Definition at line 193 of file Math.cpp.

◆ Tanh()

double DotNetDupe::System::Math::Tanh ( double dValue)
static

Returns the hyperbolic tangent of the specified angle.

Return: Hyperbolic tangent.

Definition at line 228 of file Math.cpp.

◆ Truncate()

double DotNetDupe::System::Math::Truncate ( double dValue)
static

Calculates the integral part of a specified double-precision floating-point number.

Return: Integral part of value.

Definition at line 137 of file Math.cpp.

◆ Variance()

double DotNetDupe::System::Math::Variance ( const Collections::Generic::List< double > & listValues,
bool bIsSample = false )
static

Computes the variance of a sequence of double values.

Guard: Validate sufficient observations.

Definition at line 21 of file MathStatistics.cpp.

References DotNetDupe::System::ArgumentException::ArgumentException(), DotNetDupe::System::Collections::Generic::List< T >::GetCount(), and Mean().

Referenced by StandardDeviation(), and DotNetDupe::System::Numerics::Statistics::Variance().

Member Data Documentation

◆ E

double DotNetDupe::System::Math::E = 2.71828182845904523536
staticconstexpr

Represents the natural logarithmic base, specified by the constant e.

Definition at line 22 of file Math.h.

◆ PI

double DotNetDupe::System::Math::PI = 3.14159265358979323846
staticconstexpr

Represents the ratio of the circumference of a circle to its diameter, specified by the constant pi.

Definition at line 25 of file Math.h.

◆ Tau

double DotNetDupe::System::Math::Tau = 6.28318530717958647692
staticconstexpr

Represents the number of radians in one turn, specified by the constant tau (2*pi).

Definition at line 28 of file Math.h.


The documentation for this class was generated from the following files: