Skip to main content
The ComfyMathExpression node evaluates a mathematical formula that you write as text. The formula can reference the node’s input values using letter names such as a, b, c, and you can add as many input values as needed through the growable values group. The calculation result is returned simultaneously as a floating-point number, an integer, and a boolean value.

Inputs

Notes and constraints

  • expression cannot be empty or contain only whitespace.
  • The expression must evaluate to a numeric result (INT or FLOAT). If the result is a different type, such as text, the node raises an error.
  • The numeric result must be finite and convertible to a float. Results that are too large or non-finite cause an error.
  • The whole set of input values is also available inside the expression under the variable name values (as a list), so expressions such as sum(values) are possible.
  • The following math functions are available inside the expression: sum, min, max, abs, round, pow, sqrt, ceil, floor, log, log2, log10, sin, cos, tan, int, float.

Outputs

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): 4c77e9834fe7341143352f95ed8808dc81def3361b197c67e33a531bb3696d71