ComfyUI Node: sum

Class Name

Basic data handling: SetSum

Category
Basic/SET
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling 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

sum Description

SetSum node calculates the total sum of numeric elements in a set, with an optional starting value.

sum:

The SetSum node is designed to calculate the total sum of all numeric elements within a set. This node is particularly useful when you need to aggregate values from a collection of numbers, providing a straightforward way to obtain their cumulative total. It simplifies the process of summing elements by allowing you to specify an initial starting value, which defaults to zero if not provided. This feature is beneficial for scenarios where you want to include an additional base value in the sum. The node is versatile, handling both integer and floating-point numbers, and returns the result in both formats. However, it is important to ensure that all elements in the set are numeric or compatible with addition, as mixed or incompatible types may lead to errors.

sum Input Parameters:

set

The set parameter is a required input that represents the collection of elements you wish to sum. It must be a set containing numeric values, such as integers or floats. The function of this parameter is to provide the node with the data it needs to perform the summation. The impact of this parameter on the node's execution is direct, as it determines the elements that will be included in the sum. There are no specific minimum or maximum values for this parameter, but all elements must be compatible with addition to avoid errors.

start

The start parameter is an optional input that specifies the initial value to begin the summation. By default, this value is set to 0. This parameter allows you to add a base value to the sum of the elements in the set, which can be useful in various computational scenarios. The start parameter influences the final result by adding its value to the total sum of the set elements. It must be an integer, and while there is no explicit maximum value, it should be chosen based on the desired outcome of the summation.

sum Output Parameters:

sum_int

The sum_int output parameter provides the sum of the set elements as an integer. This output is crucial for applications where an integer representation of the sum is required, such as when dealing with whole numbers or when the precision of floating-point numbers is not necessary. The interpretation of this output is straightforward: it represents the total sum of the set elements, including the optional start value, rounded to the nearest integer if necessary.

sum_float

The sum_float output parameter offers the sum of the set elements as a floating-point number. This output is important for scenarios where precision is key, such as when dealing with decimal values or when the exact total is needed. The sum_float output provides a more precise representation of the sum, including any fractional components that may result from the addition of floating-point numbers.

sum Usage Tips:

  • Ensure that all elements in the set are numeric to avoid errors during the summation process.
  • Utilize the start parameter to include an initial value in your sum, which can be helpful for calculations that require a base value.
  • Consider the data type of your elements and the desired output format when interpreting the results, as the node provides both integer and floating-point outputs.

sum Common Errors and Solutions:

TypeError: unsupported operand type(s) for +: 'int' and 'str'

  • Explanation: This error occurs when the set contains non-numeric elements, such as strings, which cannot be added to numeric types.
  • Solution: Ensure that all elements in the set are numeric (integers or floats) before using the SetSum node.

ValueError: could not convert string to float

  • Explanation: This error arises when the node attempts to convert a non-numeric string to a float during the summation process.
  • Solution: Verify that the set does not contain any non-numeric strings and that all elements are compatible with numeric operations.

sum Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
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 Models, enabling artists to harness the latest AI tools to create incredible art.