-
Notifications
You must be signed in to change notification settings - Fork 0
Class Math
Kristian Virtanen edited this page Oct 18, 2024
·
6 revisions
The Math
class provides a collection of mathematical functions and constants, including basic arithmetic operations, trigonometric functions, logarithms, rounding, and random number generation. It also includes error handling via the LastError
property, which stores the most recent error message if an operation fails.
- Description: Returns the value of Pi (π).
-
Example:
3.141592653589793
-
Description: Stores the last error message, if any operation fails, including a timestamp in
yyyy-MM-dd HH:mm:ss
format. -
Example:
"2024-10-16 14:30:00: Invalid parameter passed for GetRandomString: '0'. Positive integer expected."
- Description: Returns the absolute value of a number.
-
Parameters:
-
number
: The number whose absolute value is to be determined.
-
- Returns: The absolute value of the number.
- Description: Rounds a number up to the nearest integer.
-
Parameters:
-
number
: The number to round up.
-
- Returns: The smallest integer greater than or equal to the number.
- Description: Rounds a number down to the nearest integer.
-
Parameters:
-
number
: The number to round down.
-
- Returns: The largest integer less than or equal to the number.
- Description: Returns the natural logarithm (base e) of a number.
-
Parameters:
-
number
: The number to calculate the natural logarithm of.
-
- Returns: The natural logarithm of the number.
- Description: Returns the base-10 logarithm of a number.
-
Parameters:
-
number
: The number to calculate the base-10 logarithm of.
-
- Returns: The base-10 logarithm of the number.
- Description: Returns the cosine, sine, or tangent of a specified angle in radians.
-
Parameters:
-
angle
: The angle in radians.
-
- Returns: The cosine, sine, or tangent of the angle.
- Description: Returns the arcsine, arccosine, or arctangent of a specified value.
-
Parameters:
-
number
: The value whose arcsine, arccosine, or arctangent is to be found.
-
- Returns: The arcsine, arccosine, or arctangent in radians.
- Description: Converts the specified angle from radians to degrees.
-
Parameters:
-
angle
: The angle in radians.
-
- Returns: The equivalent angle in degrees.
- Description: Converts the specified angle from degrees to radians.
-
Parameters:
-
angle
: The angle in degrees.
-
- Returns: The equivalent angle in radians.
- Description: Returns the square root of the specified number.
-
Parameters:
-
number
: The number whose square root is to be found.
-
- Returns: The square root of the number.
- Description: Returns the result of raising a base number to a specified exponent.
-
Parameters:
-
baseNumber
: The base number. -
exponent
: The exponent to raise the base to.
-
- Returns: The base number raised to the exponent.
- Description: Rounds a number to the nearest integer.
-
Parameters:
-
number
: The number to round.
-
- Returns: The nearest integer to the number.
- Description: Returns the greater or smaller of two numbers.
-
Parameters:
-
number1
: The first number. -
number2
: The second number.
-
- Returns: The greater or smaller number.
- Description: Returns the remainder of division of two numbers.
-
Parameters:
-
dividend
: The number to be divided. -
divisor
: The number by which to divide.
-
- Returns: The remainder of the division.
- Description: Generates a random number between 1 and the specified maximum number.
-
Parameters:
-
maxNumber
: The maximum number (inclusive).
-
-
Returns: A random integer between 1 and
maxNumber
.
-
Description: Returns a random boolean value (
true
orfalse
). -
Returns: A random
true
orfalse
value.
- Description: Returns a random string with printable characters of the specified length.
-
Parameters:
-
length
: A positive integer specifying the length of the random string.
-
-
Returns: A random string, or
null
if an invalid length is provided.
- Description: Converts a double-precision floating-point number to a decimal.
-
Parameters:
-
number
: The double-precision floating-point number.
-
- Returns: The equivalent decimal value.