Visit ComfyUI Online for ready-to-use ComfyUI environment
Evaluate simple math expressions with placeholders, error handling, and basic arithmetic operations for AI artists.
The Math Expression (mtb) node is designed to evaluate simple mathematical expressions provided as strings. This node is particularly useful for AI artists who need to perform quick and straightforward calculations within their workflows without delving into complex coding. By leveraging this node, you can input a math expression and get the evaluated result, which can be either a floating-point number or an integer. The node intelligently handles placeholders within the expression, replacing them with actual values provided in the input, and supports basic arithmetic operations. It ensures that even if the expression syntax is incorrect, meaningful error messages are provided to guide you in correcting the input.
The expression
parameter is a string that contains the mathematical expression you want to evaluate. This expression can include basic arithmetic operations such as addition, subtraction, multiplication, division, and exponentiation. You can also use placeholders within the expression, which will be replaced by actual values provided in the input. The default value is an empty string, and it supports multiline input to accommodate more complex expressions. This parameter is crucial as it defines the calculation to be performed by the node.
The result (float)
output parameter provides the evaluated result of the mathematical expression as a floating-point number. This output is essential for scenarios where precision is required, and the result may not be a whole number.
The result (int)
output parameter gives the evaluated result of the mathematical expression as an integer. This output is useful when you need the result in a whole number format, rounding down any decimal values.
**
for exponentiation instead of ^
.<expression>
': <error_details>
<expression>
': <error_details>
© Copyright 2024 RunComfy. All Rights Reserved.