ComfyUI > Nodes > ComfyLiterals > Operation

ComfyUI Node: Operation

Class Name

Operation

Category
Literals
Author
M1kep (Account age: 4515days)
Extension
ComfyLiterals
Latest Updated
2024-05-22
Github Stars
0.04K

How to Install ComfyLiterals

Install this extension via the ComfyUI Manager by searching for ComfyLiterals
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyLiterals in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Operation Description

Perform arithmetic operations on numerical inputs for AI artists, offering flexibility and ease of use.

Operation:

The Operation node is designed to perform basic arithmetic operations between two numerical inputs, which can be either integers or floating-point numbers. This node is particularly useful for AI artists who need to manipulate numerical data within their workflows, providing a straightforward way to execute addition, subtraction, multiplication, or division. By allowing the selection of the operation type and handling both integer and float inputs, the node offers flexibility and ease of use, making it an essential tool for tasks that require mathematical computations. Its primary goal is to simplify the process of performing arithmetic operations, ensuring that users can focus on their creative tasks without getting bogged down by complex calculations.

Operation Input Parameters:

A Type

This parameter specifies the type of the first input value, which can be either "Int" for integer or "Float" for floating-point numbers. The choice of type affects how the input value is interpreted and processed during the operation.

B Type

Similar to A Type, this parameter determines the type of the second input value, allowing you to choose between "Int" and "Float". This ensures that the second input is correctly handled according to its specified type.

A - Int

This parameter represents the integer value for the first input when A Type is set to "Int". It is used in the arithmetic operation if the first input is an integer.

A - Float

This parameter is the floating-point value for the first input when A Type is set to "Float". It is utilized in the operation if the first input is a float.

B - Int

This parameter denotes the integer value for the second input when B Type is set to "Int". It is involved in the operation if the second input is an integer.

B - Float

This parameter is the floating-point value for the second input when B Type is set to "Float". It is used in the operation if the second input is a float.

Operation

This parameter allows you to select the type of arithmetic operation to perform. The available options are "A+B" for addition, "A-B" for subtraction, "A*B" for multiplication, and "A/B" for division. The selected operation determines how the input values are combined to produce the result.

Operation Output Parameters:

Result

The output of the node is a single numerical value that represents the result of the specified arithmetic operation. This result can be either an integer or a floating-point number, depending on the types of the input values and the operation performed. The output is crucial for further processing or analysis within your workflow.

Operation Usage Tips:

  • Ensure that the types of the input values (A Type and B Type) match the actual data you are providing to avoid unexpected results.
  • When performing division, be cautious of division by zero, which can lead to errors or undefined results. Consider adding checks or conditions to handle such cases.

Operation Common Errors and Solutions:

Invalid operation provided

  • Explanation: This error occurs when the Operation parameter is set to a value that is not recognized by the node.
  • Solution: Ensure that the Operation parameter is set to one of the valid options: "A+B", "A-B", "A*B", or "A/B".

KeyError: 'A Type' or 'B Type'

  • Explanation: This error indicates that the required input type parameters are missing from the input data.
  • Solution: Verify that both A Type and B Type parameters are correctly specified in the input data before executing the node.

Operation Related Nodes

Go back to the extension to check out more related nodes.
ComfyLiterals
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.