ComfyUI > Nodes > ComfyUI Fictiverse Nodes > Math Operation

ComfyUI Node: Math Operation

Class Name

Math Operation

Category
Fictiverse/Math
Author
Fictiverse (Account age: 1343days)
Extension
ComfyUI Fictiverse Nodes
Latest Updated
2026-04-26
Github Stars
0.02K

How to Install ComfyUI Fictiverse Nodes

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

Math Operation Description

Performs basic arithmetic operations on two floating-point numbers for creative workflows.

Math Operation:

The Math Operation node is designed to perform basic arithmetic operations between two floating-point numbers. It provides a straightforward way to execute common mathematical operations such as addition, subtraction, multiplication, division, and exponentiation. This node is particularly useful for AI artists who need to incorporate mathematical calculations into their workflows without delving into complex programming. By offering a simple interface for these operations, the Math Operation node enhances the flexibility and functionality of creative projects, allowing for dynamic adjustments and calculations within the artistic process.

Math Operation Input Parameters:

A

This parameter represents the first floating-point number involved in the operation. It serves as one of the operands for the arithmetic calculation. The default value is 0.0, and it can be adjusted to any floating-point number as needed for the specific operation.

B

This parameter represents the second floating-point number used in the operation. It acts as the other operand in the arithmetic calculation. Like parameter A, it has a default value of 0.0 and can be set to any desired floating-point number. It's important to note that when performing division, B should not be zero to avoid errors.

operation

This parameter specifies the arithmetic operation to be performed between the two numbers, A and B. The available operations are addition ("+"), subtraction ("-"), multiplication ("*"), division ("/"), and exponentiation ("^"). Selecting the appropriate operation determines the type of calculation that will be executed.

Math Operation Output Parameters:

result_int

This output provides the result of the arithmetic operation as an integer. It is derived by converting the floating-point result to an integer, which can be useful when an integer representation of the result is required for further processing or integration into other systems.

result_float

This output delivers the result of the arithmetic operation as a floating-point number. It retains the precision of the calculation, making it suitable for scenarios where exact numerical values are necessary for subsequent operations or analysis.

Math Operation Usage Tips:

  • Ensure that the operation parameter is set correctly to match the desired arithmetic operation, as this will directly affect the outcome of the calculation.
  • When performing division, double-check that the B parameter is not set to zero to prevent division errors. Consider adding a conditional check or validation step in your workflow to handle such cases gracefully.

Math Operation Common Errors and Solutions:

Division by zero

  • Explanation: This error occurs when the B parameter is set to zero while performing a division operation.
  • Solution: Ensure that the B parameter is not zero when selecting the division operation. Implement checks in your workflow to handle or prevent division by zero scenarios.

Unknown operation <operation>

  • Explanation: This error is raised when an invalid or unsupported operation is specified in the operation parameter.
  • Solution: Verify that the operation parameter is set to one of the supported operations: "+", "-", "*", "/", "^". Correct any typos or unsupported symbols in the operation selection.

Math Operation Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI Fictiverse Nodes
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.