-
Notifications
You must be signed in to change notification settings - Fork 0
Class Math
Kristian Virtanen edited this page Oct 28, 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
- Differences from orig. SB: none.
-
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."
- Differences from orig. SB: New feature, orig. SB did not have this.
- 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.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- Description: Converts the specified angle from radians to degrees.
-
Parameters:
-
angle
: The angle in radians.
-
- Returns: The equivalent angle in degrees.
- Differences from orig. SB: none.
- Description: Converts the specified angle from degrees to radians.
-
Parameters:
-
angle
: The angle in degrees.
-
- Returns: The equivalent angle in radians.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- Description: Rounds a number to the nearest integer.
-
Parameters:
-
number
: The number to round.
-
- Returns: The nearest integer to the number.
- Differences from orig. SB: none.
- Description: Returns the greater or smaller of two numbers.
-
Parameters:
-
number1
: The first number. -
number2
: The second number.
-
- Returns: The greater or smaller number.
- Differences from orig. SB: none.
- 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.
- Differences from orig. SB: none.
- 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
. - Differences from orig. SB: none.
-
Description: Returns a random boolean value (
true
orfalse
). -
Returns: A random
true
orfalse
value. - Differences from orig. SB: New feature for SBOE
- 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. - Differences from orig. SB: New feature for SBOD.
- Description: Converts a double-precision floating-point number to a decimal.
-
Parameters:
-
number
: The double-precision floating-point number.
-
- Returns: The equivalent decimal value.