Math
Number
This block allows you to define a positive or negative number and use it as part of another block. This number can either be an integer, e.g. -58
, or a float, e.g., 1.58
.
Operation
With this block you can make basic mathematical operations on two numbers.
Options:
+
: addition-
: substractionx
: multiplication%
: division^
: exponentiation
Random integer
This block returns an integer between or equal to the two specified numbers, which is generated randomly at each call.
Random fraction
This block returns a random floating point number larger or equal to 0.0 and strictly smaller than 1.0.
Increase variable
This block, adds a number to a selected variable. When choosing a negative number, the number is substracted.
Constrain value
This block restricts a value to a specified range. The result will be identical if the value is between the two limits. In case the value is smaller than the minimum (resp larger then the maximum), the result will be set to the minimum (resp maximum).
Map value
Mathematical functions
This block allows you to apply classical mathematical functions to numbers.
Options:
square root
absolute
: a number's numerical value without regard to its sign-
: opposite number (sign reversed)ln
: logarithm with base elog10
: logarithm to base 10e^
: exponentiation with base e10^
: exponentiation with base 10
Trigonometric functions
This block allows you to apply classical trigonometric functions to numbers.
Options:
sin
: calculates the sine of an angle (in radians), result is between -1 and 1cos
: calculates the cosine of an angle (in radians), result is between -1 and 1tan
: calculates the tangent of an angle (in radians), result is between negative infinity and infinityasin
: calculates the arc sine of a given number in radiansacos
: calculates the arc cosine of a given number in radiansatan
: calculates the arc tangent of a given number in radians
Mathematical constants
This block provides you with mathematical constants.
Options:
π
: Archimedes' constant, equals approximately to 3.1415926535e
: Euler's number, equals approximately to 2.7182818284φ
: Golden ratio, equals approximately to 1.61803398874sqrt(2)
: Pythagoras' constant, square root of 2, equals approximately to 1.4142135623sqrt(1/2)
: square root of 1/2∞
: infinity
Number checks
With this block you can do typical number checks. The result will be true
or false
.
Options:
even
: checks if an integer is even (divisible by 2)odd
: checks if an integer is odd (not even)prime
: checks if an integer is a prime numberwhole
: checks if a number is an integerpositive
: checks if a number is > or = to 0negative
: checks if a number is < than 0divisible by
: checks if a number is divisible by a given number
Rounding a number
This block allows you to round a floating point number to an integer.
Options:
round
: rounds the number to the nearest integer, e.g. round(5.6) = 6round up
: rounds the number to the nearest integer larger than the number, e.g. round(5.2) = 6round down
: rounds the number to the nearest integer smaller than the number, e.g. round(5.6) = 5