> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-docs-cms-changelog-node-lifecycle.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ComfyMathExpression - ComfyUI Built-in Node Documentation

> The ComfyMathExpression node evaluates a mathematical formula that you write as text.

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

| Parameter    | Description                                                                                                                                                                                                                                                                                                                   | Data Type           | Required | Range                            |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | -------- | -------------------------------- |
| `expression` | The mathematical formula to evaluate, written as text (for example `a + b`), using the letter names of the input values as variables. Multiline input. (default: "a + b")                                                                                                                                                     | STRING              | Yes      | N/A                              |
| `values`     | Growable group of input values that provides the variables for the expression. Each value added to the group automatically gets the next lowercase letter name starting at `a` (`a`, `b`, `c`, ...), and that name can then be used inside `expression`. Each item accepts a number (INT or FLOAT) or a boolean (TRUE/FALSE). | FLOAT, INT, BOOLEAN | Yes      | 1 to 26 values, named `a` to `z` |

### 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

| Output Name | Description                                                                                               | Data Type |
| ----------- | --------------------------------------------------------------------------------------------------------- | --------- |
| `FLOAT`     | The result of the expression as a floating-point number.                                                  | FLOAT     |
| `INT`       | The result of the expression converted to an integer, with the decimal part truncated.                    | INT       |
| `BOOL`      | The result converted to a boolean value: TRUE when the numeric result is not zero, FALSE when it is zero. | BOOLEAN   |

> This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! [Edit on GitHub](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/ComfyMathExpression/en.md)

***

**Source fingerprint (SHA-256):** `4c77e9834fe7341143352f95ed8808dc81def3361b197c67e33a531bb3696d71`
