Skip to main content
The ComfyMathExpression node evaluates a mathematical formula using a set of input values. You can write an expression using variable names (like a, b, c), and the node will calculate the result. It supports dynamically adding as many input values as needed for your calculation.

Inputs

ParameterDescriptionData TypeRequiredRange
expressionThe mathematical formula to evaluate. You can use variable names that correspond to the input values (default: “a + b”).STRINGYesN/A
valuesA set of numeric or boolean inputs that can be dynamically added. Each input is assigned a letter from the alphabet (a, b, c, …) to be used as a variable in the expression. At least one input value is required.FLOAT, INT, BOOLEANNoN/A
Parameter Constraints:
  • The expression parameter cannot be empty or contain only whitespace.
  • The expression must evaluate to a finite numeric result (INT or FLOAT). Boolean or other non-numeric results will cause an error.
  • The input values for the values parameter can be numbers (INT or FLOAT) or boolean values (TRUE/FALSE).
  • At least one input value must be provided in the values group.

Outputs

Output NameDescriptionData Type
FLOATThe result of the mathematical expression as a floating-point number.FLOAT
INTThe result of the mathematical expression as an integer.INT
BOOLThe result of the mathematical expression as a boolean value.BOOLEAN
This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! Edit on GitHub

Source fingerprint (SHA-256): bf6221a7e1e955bdb56482de0a86a782494b2775fdd2edfde9fd20a9df0fe1a7