12 return std::abs(iValue);
17 return std::abs(llValue);
22 return std::fabs(fValue);
27 return std::fabs(dValue);
32 return (iVal1 >= iVal2) ? iVal1 : iVal2;
35 long long Math::Max(
long long llVal1,
long long llVal2) {
37 return (llVal1 >= llVal2) ? llVal1 : llVal2;
42 return (fVal1 >= fVal2) ? fVal1 : fVal2;
47 return (dVal1 >= dVal2) ? dVal1 : dVal2;
52 return (iVal1 <= iVal2) ? iVal1 : iVal2;
55 long long Math::Min(
long long llVal1,
long long llVal2) {
57 return (llVal1 <= llVal2) ? llVal1 : llVal2;
62 return (fVal1 <= fVal2) ? fVal1 : fVal2;
67 return (dVal1 <= dVal2) ? dVal1 : dVal2;
73 if (iValue < iMin)
return iMin;
74 if (iValue > iMax)
return iMax;
78 long long Math::Clamp(
long long llValue,
long long llMin,
long long llMax) {
81 if (llValue < llMin)
return llMin;
82 if (llValue > llMax)
return llMax;
89 if (dValue < dMin)
return dMin;
90 if (dValue > dMax)
return dMax;
96 if (iValue > 0)
return 1;
97 if (iValue < 0)
return -1;
103 if (llValue > 0)
return 1;
104 if (llValue < 0)
return -1;
110 if (dValue > 0.0)
return 1;
111 if (dValue < 0.0)
return -1;
117 return std::floor(dValue);
122 return std::ceil(dValue);
127 return std::round(dValue);
133 double dFactor = std::pow(10.0, iDigits);
134 return std::round(dValue * dFactor) / dFactor;
139 return std::trunc(dValue);
144 return std::sqrt(dValue);
149 return std::cbrt(dValue);
154 return std::pow(dBase, dExponent);
159 return std::exp(dValue);
164 return std::log(dValue);
169 if (dNewBase <= 0.0 || dNewBase == 1.0)
throw ArgumentException(
"Base must be positive and not equal to 1.");
170 return std::log(dValue) / std::log(dNewBase);
175 return std::log10(dValue);
180 return std::log2(dValue);
185 return std::sin(dValue);
190 return std::cos(dValue);
195 return std::tan(dValue);
200 return std::asin(dValue);
205 return std::acos(dValue);
210 return std::atan(dValue);
215 return std::atan2(dY, dX);
220 return std::sinh(dValue);
225 return std::cosh(dValue);
230 return std::tanh(dValue);
Defines the exception thrown when an invalid argument is provided to a method.
Defines the exception thrown when an argument value is outside the acceptable range of values.
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical f...
ArgumentException(const String &sMessage)
Initializes a new instance of the ArgumentException class with a specified error message.
ArgumentOutOfRangeException(const String &sMessage)
Initializes a new instance of the ArgumentOutOfRangeException class with a specified error message.
static double Cos(double dValue)
Returns the cosine of the specified angle.
static double Floor(double dValue)
Returns the largest integral value less than or equal to the specified number.
static double Log2(double dValue)
Returns the base 2 logarithm of a specified number.
static double Round(double dValue)
Rounds a double-precision floating-point value to the nearest integral value.
static double Exp(double dValue)
Returns e raised to the specified power.
static double Sin(double dValue)
Returns the sine of the specified angle.
static int Clamp(int iValue, int iMin, int iMax)
Returns a value clamped to the inclusive range of min and max.
static double Asin(double dValue)
Returns the angle whose sine is the specified number.
static int Sign(int iValue)
Returns an integer that indicates the sign of a 32-bit signed integer.
static double Acos(double dValue)
Returns the angle whose cosine is the specified number.
static int Min(int iVal1, int iVal2)
Returns the smaller of two 32-bit signed integers.
static double Tan(double dValue)
Returns the tangent of the specified angle.
static double Log(double dValue)
Returns the natural (base e) logarithm of a specified number.
static int Max(int iVal1, int iVal2)
Returns the larger of two 32-bit signed integers.
static double Truncate(double dValue)
Calculates the integral part of a specified double-precision floating-point number.
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 Log10(double dValue)
Returns the base 10 logarithm of a specified number.
static double Sqrt(double dValue)
Returns the square root of a specified number.
static double Pow(double dBase, double dExponent)
Returns a specified number raised to the specified power.
static double Cosh(double dValue)
Returns the hyperbolic cosine of the specified angle.
static double Sinh(double dValue)
Returns the hyperbolic sine of the specified angle.
static double Atan2(double dY, double dX)
Returns the angle whose tangent is the quotient of two specified numbers.
static double Atan(double dValue)
Returns the angle whose tangent is the specified number.
static int Abs(int iValue)
Returns the absolute value of a 32-bit signed integer.
static double Tanh(double dValue)
Returns the hyperbolic tangent of the specified angle.