4. Math

4.1. Mathematical Operations


This Math Command takes two input values, these include; numbers, strings, variables, and parameters.

You can select a mathematical sign from the drop-down menu; “+” Addition, “-“ Subtraction, “*” Multiplication, “/” Division, and “%” Modulo. The Math Command performs the desired arithmetic on the two input values and returns the sum, difference, product, quotient, or remainder of division between these values.

The following is an example of how you can use modulo. We check to see if Tick Count mod”%” 20 equals 1, which it will, once a second. We can then increase the Timer variable by 1 every second.

Tick code

Modulo Operation:

The Modulo Operation, mod or % for short, returns the remainder of division between two values. For example 24 mod 9 is 6, because 24/9 = 2, 2*9 = 18, and the remainder is 24-18 = 6. This is very useful in programming. Another example would be if we wanted to find out if a number is odd or even. We can do any number mod 2. If the number is even, the result will be zero, otherwise it will be one.

More information on modulo can be found here: Modular Arithmetic Wikipedia

4.2. Unary Math Functions

Unary math

Unary Math Functions take only one input value(number,variable,parameter), and apply a function selected from the drop-down menu:

  • ABS – Returns the Absolute Value of the input value, this will always be a positive number
  • FLOOR – Returns the input value Rounded Down to the nearest whole number
  • CEIL – Returns the input value Rounded Up to the nearest whole number
  • ROUND – Returns the input value Rounded to the nearest whole number
  • SQRT – Returns the Square Root of the input value
  • LN – Returns the Natural Logarithm of the input value with e as the base
  • SIN – Returns the Sine of the input value
  • COS – Returns the Cosine of the input value
  • Tan – Returns the Tangent of the input value
  • ASIN – Returns the Arc-Sine of the input value
  • ACOS – Returns the Arc-Cosine of the input value
  • ATAN – Returns the Arc-Tangent of the input value

4.3. Binary Math Functions

Binary math

Binary Math Functions take two input values(numbers,variables,parameters), and apply a function selected from the drop-down menu:

  • Random – Returns a Random number between the two input values
  • Min – Returns the Minimum or lowest number of the two input values
  • Max – Returns the Maximum or highest number of the two input values
  • Power – Returns the first input value to the Power of the second input value
  • Log – Returns the Logarithm of the first input value with the second input value as the base
  • Atan2 – Returns the Arc-Tangent using two input values