Number functions
Manipulate numbers.
clamp()
Clamps number
within the inclusive lower
and upper
bounds.
clamp(number, lower, upper)
Arguments
Returns
- (Number)
- The clamped number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
epsilon()
Returns the smallest positive numeric value representable in JavaScript.
epsilon()
Returns
- (Number)
- The epsilon number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
in_range()
Checks if number
is between start
and up to, but not including, end
. If start
is greater than end
the params are swapped to support negative ranges.
in_range(number, start, end)
Arguments
number
(Number)- The number to check.
start
(Number)- The start of the range.
end
(Number)- The end of the range.
Returns
- (Number)
true
if number is in the range, elsefalse
.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
max_number()
Returns the maximum numeric value representable in JavaScript.
max_number()
Returns
- (Number)
- The max number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
max_safe_integer()
Returns the maximum safe integer in JavaScript (2^53 - 1
).
max_safe_integer()
Returns
- (Number)
- The maximum safe integer number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
min_number()
Returns the smallest positive numeric value representable in JavaScript.
min_number()
Returns
- (Number)
- The min number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
min_safe_integer()
Returns the minimum safe integer in JavaScript (-(2^53 - 1)
).
min_safe_integer()
Returns
- (Number)
- The minimum safe integer number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
negative_infinity()
Returns the negative Infinity value.
negative_infinity()
Returns
- (Number)
- The negative Infinity number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
positive_infinity()
Returns the positive Infinity value.
positive_infinity()
Returns
- (Number)
- The positive Infinity number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
random()
Produces a random number between the inclusive lower
and upper
bounds. If floating
is true, or either lower or upper are floats, a floating-point number is returned instead of an integer.
random(lower, upper, floating)
Arguments
lower
(Number)- The lower bound.
upper
(Number)- The upper bound.
floating
(Boolean)- Specify returning a floating-point number.
Returns
- (Number)
- The random number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|