Math Nodes
> Perform calculations, compare numbers, round values, and convert between numeric and string representations.
Math nodes are pure nodes -- they have no sequence pins and compute their result on demand when a downstream node requests the value.
Arithmetic
math-add
Adds two numbers together.
| Pin | Direction | Type | |-----|-----------|------| | a | Input | number | | b | Input | number | | result | Output | number |
math-subtract
Subtracts the second number from the first.
| Pin | Direction | Type | |-----|-----------|------| | a | Input | number | | b | Input | number | | result | Output | number |
math-multiply
Multiplies two numbers.
| Pin | Direction | Type | |-----|-----------|------| | a | Input | number | | b | Input | number | | result | Output | number |
math-divide
Divides the first number by the second.
| Pin | Direction | Type | |-----|-----------|------| | a | Input | number | | b | Input | number | | result | Output | number |
If b is zero, the result will be Infinity or -Infinity. Guard against division by zero using an if-condition node when the divisor comes from user input.
Comparison
math-equal
Returns true if two numbers are equal.
| Pin | Direction | Type | |-----|-----------|------| | a | Input | number | | b | Input | number | | result | Output | boolean |
math-greater
Returns true if the first number is greater than the second.
| Pin | Direction | Type | |-----|-----------|------| | a | Input | number | | b | Input | number | | result | Output | boolean |
math-less
Returns true if the first number is less than the second.
| Pin | Direction | Type | |-----|-----------|------| | a | Input | number | | b | Input | number | | result | Output | boolean |
Combine math-greater, math-less, and math-equal with logic nodes like if-condition to build range checks and numeric validation.
Rounding
round
Rounds a number to the nearest integer. Values at .5 round up.
| Pin | Direction | Type | |-----|-----------|------| | value | Input | number | | result | Output | number |
Type Conversions
These nodes convert between string, number, float, and boolean types. They are pure nodes with no sequence pins.
convert-string-to-number
Converts a string to a number. Returns NaN if the string cannot be parsed.
| Pin | Direction | Type | |-----|-----------|------| | value | Input | string | | result | Output | number |
convert-string-to-float
Converts a string to a floating-point number.
| Pin | Direction | Type | |-----|-----------|------| | value | Input | string | | result | Output | float |
convert-number-to-string
Converts a number to its string representation.
| Pin | Direction | Type | |-----|-----------|------| | value | Input | number | | result | Output | string |
convert-float-to-string
Converts a floating-point number to its string representation.
| Pin | Direction | Type | |-----|-----------|------| | value | Input | float | | result | Output | string |
convert-boolean-to-string
Converts a boolean value to "true" or "false".
| Pin | Direction | Type | |-----|-----------|------| | value | Input | boolean | | result | Output | string |
convert-boolean-to-number
Converts a boolean to a number: true becomes 1, false becomes 0.
| Pin | Direction | Type | |-----|-----------|------| | value | Input | boolean | | result | Output | number |
number-to-float
Converts an integer number to a floating-point number.
| Pin | Direction | Type | |-----|-----------|------| | value | Input | number | | result | Output | float |
enum-to-string
Converts an enum value to its string representation.
| Pin | Direction | Type | |-----|-----------|------| | value | Input | enum | | result | Output | string |
Type conversion nodes are essential when connecting nodes with different numeric types. Use them to bridge between number and float types, or to convert values for display as strings.