Public Member Functions

template<>
float Min_ (float val1, float val2)
 
template<>
double Min_ (double val1, double val2)
 
template<>
float Max_ (float val1, float val2)
 
template<>
double Max_ (double val1, double val2)
 

Static Public Member Functions

static ASPOSECPP_SHARED_API double Acos (double d)
 
static ASPOSECPP_SHARED_API double Asin (double d)
 
static ASPOSECPP_SHARED_API double Atan (double d)
 
static ASPOSECPP_SHARED_API double Atan2 (double y, double x)
 
static ASPOSECPP_SHARED_API Decimal Ceiling (const Decimal &d)
 
static ASPOSECPP_SHARED_API double Ceiling (double a)
 
static ASPOSECPP_SHARED_API double Cos (double d)
 
static ASPOSECPP_SHARED_API double Cosh (double value)
 
static ASPOSECPP_SHARED_API Decimal Floor (const Decimal &d)
 
static ASPOSECPP_SHARED_API double Floor (double d)
 
static ASPOSECPP_SHARED_API double Sin (double a)
 
static ASPOSECPP_SHARED_API double Tan (double a)
 
static ASPOSECPP_SHARED_API double Sinh (double value)
 
static ASPOSECPP_SHARED_API double Tanh (double value)
 
static ASPOSECPP_SHARED_API double Round (double a)
 
static ASPOSECPP_SHARED_API double Round (double value, int digits)
 
static ASPOSECPP_SHARED_API double Round (double value, MidpointRounding mode)
 
static ASPOSECPP_SHARED_API double Round (double value, int digits, MidpointRounding mode)
 
static ASPOSECPP_SHARED_API Decimal Round (const Decimal &d)
 
static ASPOSECPP_SHARED_API Decimal Round (const Decimal &value, int digits)
 
static ASPOSECPP_SHARED_API Decimal Round (const Decimal &d, MidpointRounding mode)
 
static ASPOSECPP_SHARED_API Decimal Round (const Decimal &d, int digits, MidpointRounding mode)
 
static ASPOSECPP_SHARED_API Decimal Truncate (const Decimal &d)
 
static ASPOSECPP_SHARED_API double Truncate (double d)
 
static ASPOSECPP_SHARED_API double Sqrt (double d)
 
static ASPOSECPP_SHARED_API double Log (double d)
 
static ASPOSECPP_SHARED_API double Log10 (double d)
 
static ASPOSECPP_SHARED_API double Exp (double d)
 
static ASPOSECPP_SHARED_API double Pow (double x, double y)
 
static ASPOSECPP_SHARED_API double IEEERemainder (double x, double y)
 
template<class T >
static T Abs (T value)
 
static Decimal Abs (const Decimal &d)
 
static ASPOSECPP_SHARED_API double Log (double a, double newBase)
 
template<typename T >
static std::enable_if< std::is_integral< T >::value &&!std::is_unsigned< T >::value, int >::type Sign (T value)
 
template<typename T >
static std::enable_if< std::is_floating_point< T >::value, int >::type Sign (T value)
 
static int Sign (const Decimal &value)
 
static ASPOSECPP_SHARED_API int64_t BigMul (int a, int b)
 
static ASPOSECPP_SHARED_API int DivRem (int a, int b, int &result)
 
static ASPOSECPP_SHARED_API int64_t DivRem (int64_t a, int64_t b, int64_t &result)
 
template<class T >
static T Modulus (T x, T y)
 
template<class T0 , class T1 , class = typename std::enable_if<!std::is_same<T0, T1>::value, void>::type>
static auto Min (T0 val1, T1 val2) -> decltype(val1+val2)
 
template<class T0 , class T1 , class = typename std::enable_if<std::is_same<T0, T1>::value, void>::type>
static T0 Min (T0 val1, T1 val2)
 
template<class T0 , class T1 , class = typename std::enable_if<!std::is_same<T0, T1>::value, void>::type>
static auto Max (T0 val1, T1 val2) -> decltype(val1+val2)
 
template<class T0 , class T1 , class = typename std::enable_if<std::is_same<T0, T1>::value, void>::type>
static T0 Max (T0 val1, T1 val2)
 

Static Public Attributes

static const double ASPOSECPP_SHARED_API PI
 The number Pi constant. More...
 
static const double ASPOSECPP_SHARED_API E
 Natural logarithm's base. More...
 
static const double ASPOSECPP_SHARED_API PositiveInfinity
 Represents the positive infinity. More...
 
static const double ASPOSECPP_SHARED_API NegativeInfinity
 Represents the negative infinity. More...
 
static const double ASPOSECPP_SHARED_API NaN
 Represents a not-a-number value. More...
 

Detailed Description

Contains math functions. This is a static type with no instance services. You should never create instances of it by any means.

#include "system/math.h"
#include <iostream>
int main()
{
using namespace System;
// Print the absolute values.
for (int i = -1; i < 2; ++i)
{
std::cout << Math::Abs(i) << " ";
}
std::cout << std::endl;
// Print the sine of PI/2 and the cosine of PI.
std::cout << "sin(PI/2)=" << Math::Sin(Math::PI/2) << "; cos(PI)=" << Math::Cos(Math::PI) << std::endl;
return 0;
}
/*
* This code example produces the following output:
* 1 0 1
* sin(PI/2)=1; cos(PI)=-1
*/

Member Function Documentation

◆ Abs() [1/2]

template<class T >
static T System::Math::Abs ( value)
inlinestatic

Returns the absolute value of the specified value

Parameters
valueA value of arithmetic type
Returns
The absolute value of value
Template Parameters
TThe type of the value accepted by the method as an argument

◆ Abs() [2/2]

static Decimal System::Math::Abs ( const Decimal d)
inlinestatic

Returns the absolute value of a value represented by the specified Decimal object

Parameters
dA Decimal object
Returns
The Decimal object representing the absolute value of the value represented by value

◆ Acos()

static ASPOSECPP_SHARED_API double System::Math::Acos ( double  d)
static

Calculates the arccosine of the specified value.

Parameters
dThe value to calculate arccosine of
Returns
Arccosine of d

◆ Asin()

static ASPOSECPP_SHARED_API double System::Math::Asin ( double  d)
static

Calculates the arcsin of the specified value.

Parameters
dThe value to calculate arcsin of
Returns
Arcsin of d

◆ Atan()

static ASPOSECPP_SHARED_API double System::Math::Atan ( double  d)
static

Calculates the arctan of the specified value.

Parameters
dThe value to calculate arctan of
Returns
Arctan of d

◆ Atan2()

static ASPOSECPP_SHARED_API double System::Math::Atan2 ( double  y,
double  x 
)
static

Calculates the arctan of the ration of the specified values.

Parameters
yThe point's y coordinate
xThe point's x coordinate
Returns
Arctan of y/x

◆ BigMul()

static ASPOSECPP_SHARED_API int64_t System::Math::BigMul ( int  a,
int  b 
)
static

Returns the full product of two 32-bit integers.

Parameters
aThe first multiplier
bThe second multiplier
Returns
The product of a and b

◆ Ceiling() [1/2]

static ASPOSECPP_SHARED_API Decimal System::Math::Ceiling ( const Decimal d)
static

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

Parameters
dA decimal number
Returns
The smallest integral value that is greater than or equal to d

◆ Ceiling() [2/2]

static ASPOSECPP_SHARED_API double System::Math::Ceiling ( double  a)
static

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

Parameters
aA double-precision floating point number
Returns
The smallest integral value that is greater than or equal to d

◆ Cos()

static ASPOSECPP_SHARED_API double System::Math::Cos ( double  d)
static

Calculates the cosine of the specified value.

Parameters
dThe value to calculate the cosine of
Returns
The cosine of d

◆ Cosh()

static ASPOSECPP_SHARED_API double System::Math::Cosh ( double  value)
static

Calculates the hyperbolic cosine of the specified value.

Parameters
valueThe value to calculate the hyperbolic cosine of
Returns
The hyperbolic cosine of value

◆ DivRem() [1/2]

static ASPOSECPP_SHARED_API int System::Math::DivRem ( int  a,
int  b,
int &  result 
)
static

Calculates the quotient of two 32-bit integers and the remainder.

Parameters
aThe dividend
bThe divisor
resultThe output parameter that contains the remainder resulting from division of a by b
Returns
The quoting of a and b

◆ DivRem() [2/2]

static ASPOSECPP_SHARED_API int64_t System::Math::DivRem ( int64_t  a,
int64_t  b,
int64_t &  result 
)
static

Calculates the quotient of two 64-bit integers and the remainder.

Parameters
aThe dividend
bThe divisor
resultThe output parameter that contains the remainder resulting from division of a by b
Returns
The quoting of a and b

◆ Exp()

static ASPOSECPP_SHARED_API double System::Math::Exp ( double  d)
static

Returns e constant raised to the specified power.

Parameters
dThe power to raise e constant to
Returns
e constant raised to the power of d

◆ Floor() [1/2]

static ASPOSECPP_SHARED_API Decimal System::Math::Floor ( const Decimal d)
static

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

Parameters
dA decimal number
Returns
The largest integral value that is less than or equal to d

◆ Floor() [2/2]

static ASPOSECPP_SHARED_API double System::Math::Floor ( double  d)
static

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

Parameters
dA double-precision floating point number
Returns
The largest integral value that is less than or equal to d

◆ IEEERemainder()

static ASPOSECPP_SHARED_API double System::Math::IEEERemainder ( double  x,
double  y 
)
static

Returns the remainder resulting from the division of a specified number by another specified number.

Parameters
xDividend
yDivisor
Returns
The remainder resulting from the division of a specified number by another specified number.

◆ Log() [1/2]

static ASPOSECPP_SHARED_API double System::Math::Log ( double  d)
static

Returns the natural logarithm of the specified value.

Parameters
dA double-precision floating point value
Returns
The natural logarithm of d

◆ Log() [2/2]

static ASPOSECPP_SHARED_API double System::Math::Log ( double  a,
double  newBase 
)
static

Returns the logarithm of the specified value in the specified base.

Parameters
aA double-precision floating point value
newBaseThe base of the logarithm
Returns
The logarithm of a in the newBase base

◆ Log10()

static ASPOSECPP_SHARED_API double System::Math::Log10 ( double  d)
static

Returns the base-10 logarithm of the specified value.

Parameters
dA double-precision floating point value
Returns
The base-10 logarithm of d

◆ Max() [1/2]

template<class T0 , class T1 , class = typename std::enable_if<!std::is_same<T0, T1>::value, void>::type>
static auto System::Math::Max ( T0  val1,
T1  val2 
) -> decltype(val1 + val2)
inlinestatic

Returns the greatest value out of two numeric ones specified.

Template Parameters
T0Type of first value.
T1Type of second value.
Parameters
val1First value.
val2Second value.
Returns
Greatest value out of val1 and val2.

◆ Max() [2/2]

template<class T0 , class T1 , class = typename std::enable_if<std::is_same<T0, T1>::value, void>::type>
static T0 System::Math::Max ( T0  val1,
T1  val2 
)
inlinestatic

Returns the greatest value out of two numeric ones specified.

Template Parameters
T0Type of first value.
T1Type of second value.
Parameters
val1First value.
val2Second value.
Returns
Greatest value out of val1 and val2.

◆ Max_() [1/2]

template<>
float System::Math::Max_ ( float  val1,
float  val2 
)
inline

Returns the largest single-precision floating point value out of the two specified.

Parameters
val1The first comparand
val2The second comparand
Returns
The largest value out of val1 and val2; or NaN if one of the operands is NaN

◆ Max_() [2/2]

template<>
double System::Math::Max_ ( double  val1,
double  val2 
)
inline

Returns the largest double-precision floating point value out of the two specified.

Parameters
val1The first comparand
val2The second comparand
Returns
The largest value out of val1 and val2; or NaN if one of the operands is NaN

◆ Min() [1/2]

template<class T0 , class T1 , class = typename std::enable_if<!std::is_same<T0, T1>::value, void>::type>
static auto System::Math::Min ( T0  val1,
T1  val2 
) -> decltype(val1 + val2)
inlinestatic

Returns the smallest value out of two numeric ones specified.

Template Parameters
T0Type of first value.
T1Type of second value.
Parameters
val1First value.
val2Second value.
Returns
Smallest value out of val1 and val2.

◆ Min() [2/2]

template<class T0 , class T1 , class = typename std::enable_if<std::is_same<T0, T1>::value, void>::type>
static T0 System::Math::Min ( T0  val1,
T1  val2 
)
inlinestatic

Returns the smallest value out of two numeric ones specified.

Template Parameters
T0Type of first value.
T1Type of second value.
Parameters
val1First value.
val2Second value.
Returns
Smallest value out of val1 and val2.

◆ Min_() [1/2]

template<>
float System::Math::Min_ ( float  val1,
float  val2 
)
inline

Returns the smallest single-precision floating point value out of the two specified.

Parameters
val1The first comparand
val2The second comparand
Returns
The smallest value out of val1 and val2; or NaN if one of the operands is NaN

◆ Min_() [2/2]

template<>
double System::Math::Min_ ( double  val1,
double  val2 
)
inline

Returns the smallest double-precision floating point value out of the two specified.

Parameters
val1The first comparand
val2The second comparand
Returns
The smallest value out of val1 and val2; or NaN if one of the operands is NaN

◆ Modulus()

template<class T >
static T System::Math::Modulus ( x,
y 
)
inlinestatic

Calculates the remainder resulting from the division one specified value by another specified value.

Parameters
xThe dividend
yThe divisor
Returns
The reminder resulting from the division of x by y
Template Parameters
TThe type of the method's arguments

◆ Pow()

static ASPOSECPP_SHARED_API double System::Math::Pow ( double  x,
double  y 
)
static

Returns the specified value raised to the specified power.

Parameters
xThe value to raise to the specified power
yThe power to raise the specified value to
Returns
x raised to the power of y

◆ Round() [1/8]

static ASPOSECPP_SHARED_API double System::Math::Round ( double  a)
static

Rounds the specified value to the nearest integral value.

Parameters
aThe value to round
Returns
a rounded to the nearest integral value

◆ Round() [2/8]

static ASPOSECPP_SHARED_API double System::Math::Round ( double  value,
int  digits 
)
static

Rounds the specified value to the nearest value with the specified number of fractional digits.

Parameters
valueThe value to round
digitsThe number of fractional digits in the rounded value
Returns
The number with the specified number of digits nearest to value

◆ Round() [3/8]

static ASPOSECPP_SHARED_API double System::Math::Round ( double  value,
MidpointRounding  mode 
)
static

Rounds the specified value to the nearest integral number. A parameter specifies the function's behavior if the specified value is equally close to two nearest numbers.

Parameters
valueThe value to round
modeSpecifies how to perform the rounding if value is equally close to two nearest numbers.
Returns
value rounded to the nearest integral value

◆ Round() [4/8]

static ASPOSECPP_SHARED_API double System::Math::Round ( double  value,
int  digits,
MidpointRounding  mode 
)
static

Rounds the specified value to the nearest value with the specified number of fractional digits. A parameter specifies the function's behavior if the specified value is equally close to two nearest numbers.

Parameters
valueThe value to round
digitsThe number of fractional digits in the rounded value
modeSpecifies how to perform the rounding if value is equally close to two nearest numbers.
Returns
The number with the specified number of digits nearest to value

◆ Round() [5/8]

static ASPOSECPP_SHARED_API Decimal System::Math::Round ( const Decimal d)
static

Rounds the specified value to the nearest integral value.

Parameters
dThe value to round
Returns
d rounded to the nearest integral value

◆ Round() [6/8]

static ASPOSECPP_SHARED_API Decimal System::Math::Round ( const Decimal value,
int  digits 
)
static

Rounds the specified value to the nearest value with the specified number of fractional digits.

Parameters
valueThe value to round
digitsThe number of fractional digits in the rounded value
Returns
The number with the specified number of digits nearest to value

◆ Round() [7/8]

static ASPOSECPP_SHARED_API Decimal System::Math::Round ( const Decimal d,
MidpointRounding  mode 
)
static

Rounds the specified value to the nearest integral number. A parameter specifies the function's behavior if the specified value is equally close to two nearest numbers.

Parameters
dThe value to round
modeSpecifies how to perform the rounding if value is equally close to two nearest numbers.
Returns
d rounded to the nearest integral value

◆ Round() [8/8]

static ASPOSECPP_SHARED_API Decimal System::Math::Round ( const Decimal d,
int  digits,
MidpointRounding  mode 
)
static

Rounds the specified value to the nearest value with the specified number of fractional digits. A parameter specifies the function's behavior if the specified value is equally close to two nearest numbers.

Parameters
dThe value to round
digitsThe number of fractional digits in the rounded value
modeSpecifies how to perform the rounding if value is equally close to two nearest numbers.
Returns
The number with the specified number of digits nearest to value

◆ Sign() [1/3]

template<typename T >
static std::enable_if<std::is_integral<T>::value && !std::is_unsigned<T>::value, int>::type System::Math::Sign ( value)
inlinestatic

Determines the sign of the specified signed integral value.

Parameters
valueThe value to determine the sign of
Returns
-1 if value is less than 0; 0 if value is equal to 0; 1 if value is greater than 0
Template Parameters
TThe integral signed type

◆ Sign() [2/3]

template<typename T >
static std::enable_if<std::is_floating_point<T>::value, int>::type System::Math::Sign ( value)
inlinestatic

Determines the sign of the specified floating-point value.

Parameters
valueThe value to determine the sign of
Returns
-1 if value is less than 0; 0 if value is equal to 0; 1 if value is greater than 0
Template Parameters
TThe floating point type of the argument

◆ Sign() [3/3]

static int System::Math::Sign ( const Decimal value)
inlinestatic

Determines the sign of the specified decimal value.

Parameters
valueThe value to determine the sign of
Returns
-1 if value is less than 0; 0 if value is equal to 0; 1 if value is greater than 0

◆ Sin()

static ASPOSECPP_SHARED_API double System::Math::Sin ( double  a)
static

Calculates the sine of the specified value.

Parameters
aThe value to calculate the sine of
Returns
The sine of a

◆ Sinh()

static ASPOSECPP_SHARED_API double System::Math::Sinh ( double  value)
static

Calculates the hyperbolic sine of the specified value.

Parameters
valueThe value to calculate the hyperbolic sine of
Returns
The hyperbolic sine of value

◆ Sqrt()

static ASPOSECPP_SHARED_API double System::Math::Sqrt ( double  d)
static

Returns the square root of the specified value.

Parameters
dA double-precision floating point value
Returns
The square root of d

◆ Tan()

static ASPOSECPP_SHARED_API double System::Math::Tan ( double  a)
static

Calculates the tangen of the specified value.

Parameters
aThe value to calculate the tangen of
Returns
The tangen of a

◆ Tanh()

static ASPOSECPP_SHARED_API double System::Math::Tanh ( double  value)
static

Calculates the hyperbolic tangen of the specified value.

Parameters
valueThe value to calculate the hyperbolic tangen of
Returns
The hyperbolic tangen of value

◆ Truncate() [1/2]

static ASPOSECPP_SHARED_API Decimal System::Math::Truncate ( const Decimal d)
static

Returns the Decimal object representing a value that has integral part equal to that of the value represented by the specified Decimal object of the with all fractional digits discarded.

Parameters
dA decimal number
Returns
A Decimal object representing a decimal value whose integral part is equal to that of the specified value and fractional digits are all 0.

◆ Truncate() [2/2]

static ASPOSECPP_SHARED_API double System::Math::Truncate ( double  d)
static

Returns a double-precision floating point value that has integral part equal to that of the specified value with all fractional digits discarded.

Parameters
dA decimal number
Returns
A double-precision floating point value whose integral part is equal to that of the specified value and fractional digits are all 0.

Member Data Documentation

◆ E

const double ASPOSECPP_SHARED_API System::Math::E
static

Natural logarithm's base.

◆ NaN

const double ASPOSECPP_SHARED_API System::Math::NaN
static

Represents a not-a-number value.

◆ NegativeInfinity

const double ASPOSECPP_SHARED_API System::Math::NegativeInfinity
static

Represents the negative infinity.

◆ PI

const double ASPOSECPP_SHARED_API System::Math::PI
static

The number Pi constant.

◆ PositiveInfinity

const double ASPOSECPP_SHARED_API System::Math::PositiveInfinity
static

Represents the positive infinity.