Mathematical functions
Abs
Declaration
double Abs(double x)
Description
Calculates the absolute value of a double value.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to calculate absolute value for. |
Return Value
The absolute value of x.
Abs
Declaration
int Abs(int x)
Description
Calculates the absolute value of an int value.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to calculate absolute value for. |
Return Value
The absolute value of x.
Acos
Declaration
double Acos(double x)
Description
Calculates the arc cosine of an angle measured in radians.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Angle in radians. |
Return Value
Arc cosine of angle.
Asin
Declaration
double Asin(double x)
Description
Calculates the arc sine of an angle measured in radians.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Angle in radians. |
Return Value
Arcsine of angle.
Atan
Declaration
double Atan(double x)
Description
Calculates the arc tangent of an angle measured in radians.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Angle in radians. |
Return Value
Arc tangent of angle.
Atan2
Declaration
double Atan2(double y, double x)
Description
Returns the angle whose tangent is the quotient of two specified numbers.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
y
|
The y coordinate of a point. |
x
|
The x coordinate of a point. |
Return Value
Arc tangent of angle.
Ceiling
Declaration
int Ceiling(double x)
Description
Returns the smallest integral value that is greater than or equal to the specified number.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Number to return ceiling for. |
Return Value
The smallest integral value that is greater than or equal to x.
Cos
Declaration
double Cos(double x)
Description
Calculates the cosine of an angle measured in radians.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Angle in radians. |
Return Value
Cosine of angle.
Cosh
Declaration
double Cosh(double x)
Description
Returns the hyperbolic cosine of the specified angle.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
An angle, measured in radians. |
Return Value
The hyperbolic cosine of the specified angle.
Exp
Declaration
double Exp(double x)
Description
Returns e raised to the specified power.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
A number specifying a power. |
Return Value
Constant e raised to the specified power.
Floor
Declaration
int Floor(double x)
Description
Returns the largest integer less than or equal to the specified number.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Number to return floor for. |
Return Value
The largest integer less than or equal to the specified number.
IEEERemainder
Declaration
double IEEERemainder(double x, double y)
Description
Returns the remainder resulting from the division of a specified number by another specified number.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
A dividend. |
y
|
A divisor. |
Return Value
The remainder resulting from the division of a specified number by another specified number.
IsDouble
Declaration
bool IsDouble(string text)
Description
Checks whether a string contains a double.
Supported Runtime Versions
2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
text
|
The string to be checked. |
Return Value
True, if the string contains a double, false otherwise.
IsInteger
Declaration
bool IsInteger(string text)
Description
Checks whether a string contains an integer.
Supported Runtime Versions
2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
text
|
The string to be checked. |
Return Value
True, if the string contains an integer, false otherwise.
IsNaN
Declaration
bool IsNaN(double x)
Description
Returns a value that indicates whether the specified value is not a number.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to be checked. |
Return Value
True, if x is not a number, false otherwise.
IsNegativeInfinity
Declaration
bool IsNegativeInfinity(double x)
Description
Returns a value indicating whether the specified number evaluates to negative infinity.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to be checked. |
Return Value
True, if x evaluates to negative infinity, false otherwise.
IsNumeric
Declaration
bool IsNumeric(string text)
Description
Checks whether a string contains a numeric literal.
Supported Runtime Versions
2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
text
|
The string to be checked. |
Return Value
True, if the string contains a numeric literal, false otherwise.
IsPositiveInfinity
Declaration
bool IsPositiveInfinity(double x)
Description
Returns a value indicating whether the specified number evaluates to positive infinity.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to be checked. |
Return Value
True, if x evaluates to positive infinity, false otherwise.
Log10
Declaration
double Log10(double x)
Description
Returns the base 10 logarithm of a specified number.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
A number whose logarithm must be found. |
Return Value
The base 10 logarithm of a specified number.
LogE
Declaration
double LogE(double x)
Description
Returns the natural (base e) logarithm of a specified number.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
The number whose logarithm must be found. |
Return Value
The natural (base e) logarithm of a specified number.
Max
Declaration
double Max(double x, double y)
Description
Calculates the maximum of two double values.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
First value. |
y
|
Second value. |
Return Value
Maximum of x and y.
Max
Declaration
int Max(int x, int y)
Description
Calculates the maximum of two int values.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
First value. |
y
|
Second value. |
Return Value
Maximum of x and y.
Min
Declaration
double Min(double x, double y)
Description
Calculates the minimum of two double values.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
First value. |
y
|
Second value. |
Return Value
Minimum of x and y.
Min
Declaration
int Min(int x, int y)
Description
Calculates the minimum of two int values.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
First value. |
y
|
Second value. |
Return Value
Minimum of x and y.
Pow
Declaration
double Pow(double x, double y)
Description
Returns a specified number raised to the specified power.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
A number to be raised to a power. |
y
|
A number that specifies a power. |
Return Value
The number x raised to the power y.
Random
Declaration
int Random()
Description
Generates a non-negative random integer.
Supported Runtime Versions
5.0
Parameters
The function has no parameters.
Return Value
Random non-negative integer.
Random
Declaration
int Random(int maxValue)
Description
Generates a non-negative random integer that is less than the specified maximum.
Supported Runtime Versions
5.0
Parameters
|
Description |
---|---|
maxValue
|
The maximum value. |
Return Value
Returns random non-negative integer that is lower than the specified value.
Random
Declaration
int Random(int minValue, int maxValue)
Description
Generates a random integer that is within a specified range.
Supported Runtime Versions
5.0
Parameters
|
Description |
---|---|
minValue
|
The minimum value. |
maxValue
|
The maximum value. |
Return Value
Returns random integer that is within a specified range.
RandomDouble
Declaration
double RandomDouble()
Description
Generates a non-negative random double.
Supported Runtime Versions
5.0
Parameters
The function has no parameters.
Return Value
Random non-negative double.
Round
Declaration
double Round(double value)
Description
Rounds a double value to the next int value. This function uses banker's rounding. If the value to be rounded is exactly halfway between two numbers, it will return the next even number. For example, Round(6.5) is equal to 6 and Round(3.5) is equal to 4.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
value
|
Value to be rounded. |
Return Value
Rounded value.
Round
Declaration
double Round(double value, bool roundAwayFromZero)
Description
Rounds a double value to the next int value.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
value
|
Value to be rounded. |
roundAwayFromZero
|
If true, value will be rounded away from zero. Otherwise, it will be rounded to the next even number. |
Return Value
Rounded value.
RoundDecimals
Declaration
double RoundDecimals(double value, int decimals)
Description
Rounds a double value to the next value having a certain amount of decimals. This function uses banker's rounding. If the value to be rounded is exactly halfway between two numbers, it will return the next even number. For example, Round(6.5) is equal to 6 and Round(3.5) is equal to 4.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
value
|
Value to be rounded. |
decimals
|
Number of decimals to round to. |
Return Value
Value rounded to 'decimals' decimals.
RoundDecimals
Declaration
double RoundDecimals(double value, int decimals, bool roundAwayFromZero)
Description
Rounds a double value to the next value having a certain number of decimals.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
value
|
Value to be rounded. |
decimals
|
Number of decimals to round to. |
roundAwayFromZero
|
If true, value will be rounded away from zero. Otherwise, it will be rounded to the next even number. |
Return Value
Value rounded to 'decimals' decimals.
Sign
Declaration
double Sign(double x)
Description
Calculates the sign of a double value.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to calculate sign for. |
Return Value
The sign of x.
Sign
Declaration
int Sign(int x)
Description
Calculates the sign of an int value.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to calculate sign for. |
Return Value
The sign of x.
Sin
Declaration
double Sin(double x)
Description
Calculates the sine of an angle measured in radians.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Angle in radians. |
Return Value
Sine of angle.
Sinh
Declaration
double Sinh(double x)
Description
Returns the hyperbolic sine of the specified angle.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
An angle, measured in radians. |
Return Value
The hyperbolic sine of the specified angle.
Sqr
Declaration
double Sqr(double x)
Description
Calculates the square of a double value.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to calculate the square for. |
Return Value
Square of x.
Sqr
Declaration
int Sqr(int x)
Description
Calculates the square of a int value.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to calculate the square for. |
Return Value
Square of x.
Sqrt
Declaration
double Sqrt(double x)
Description
Calculates the square root of a double value.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Value to calculate the square root for. |
Return Value
Square root of x.
Tan
Declaration
double Tan(double x)
Description
Calculates the tangent of an angle measured in radians.
Supported Runtime Versions
1.0, 2.0, 3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
Angle in radians. |
Return Value
Tangent of angle.
Tanh
Declaration
double Tanh(double x)
Description
Returns the hyperbolic tangent of the specified angle.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
An angle, measured in radians. |
Return Value
The hyperbolic tangent of the specified angle.
Truncate
Declaration
double Truncate(double x)
Description
Calculates the integral part of a specified number.
Supported Runtime Versions
3.0, 4.0, 5.0
Parameters
|
Description |
---|---|
x
|
A number to truncate. |
Return Value
The integral part of x; that is, the number that remains after any fractional digits have been discarded.