ComfyUI  >  Nodes  >  ComfyMath >  NumberUnaryOperation

ComfyUI Node: NumberUnaryOperation

Class Name


evanspearman (Account age: 4247 days)
Latest Updated
Github Stars

How to Install ComfyMath

Install this extension via the ComfyUI Manager by searching for  ComfyMath
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyMath 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

NumberUnaryOperation Description

Perform various unary operations on numerical inputs for AI artists, simplifying mathematical transformations in creative projects.


The CM_NumberUnaryOperation node is designed to perform a variety of unary operations on numerical inputs. This node is particularly useful for AI artists who need to manipulate numbers within their workflows, providing a straightforward way to apply mathematical functions to a single number. Whether you need to compute the absolute value, square root, or any other unary operation, this node simplifies the process by offering a range of predefined operations. Its primary goal is to enhance your creative projects by enabling precise and efficient numerical transformations.

NumberUnaryOperation Input Parameters:


The op parameter specifies the unary operation to be performed on the input number. It accepts a list of available operations, such as "abs" for absolute value, "sqrt" for square root, and other mathematical functions. This parameter determines the type of transformation applied to the input number, significantly impacting the node's output. The available options are predefined and can be selected based on your specific needs.


The a parameter represents the input number on which the unary operation will be performed. It can be either an integer or a float, providing flexibility in the types of numerical data you can work with. The default value is 0.0, but you can input any number within the range supported by your specific operation. This parameter is crucial as it serves as the primary data point for the node's computation.

NumberUnaryOperation Output Parameters:


The NUMBER output parameter is the result of the unary operation applied to the input number a. This output is a float, regardless of whether the input was an integer or a float. The value of this parameter reflects the transformation specified by the op parameter, providing you with the computed result that can be used in subsequent nodes or processes within your workflow.

NumberUnaryOperation Usage Tips:

  • To achieve the best results, ensure that the op parameter is set to the correct operation that matches your intended transformation.
  • Use the a parameter to input the number you wish to manipulate, and verify that it falls within the acceptable range for the chosen operation to avoid errors.

NumberUnaryOperation Common Errors and Solutions:

Invalid operation selected

  • Explanation: The op parameter was set to an operation that is not supported by the node.
  • Solution: Check the list of available operations and select a valid one.

Input number out of range

  • Explanation: The input number a is outside the acceptable range for the selected unary operation.
  • Solution: Ensure that the input number is within the valid range for the chosen operation. For example, the square root operation requires a non-negative number.

TypeError: unsupported operand type(s)

  • Explanation: The input number a is not a valid number type (int or float).
  • Solution: Verify that the input number is either an integer or a float and adjust the input accordingly.

NumberUnaryOperation Related Nodes

Go back to the extension to check out more related nodes.

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.