ComfyUI > Nodes > Basic data handling > integer ratio

ComfyUI Node: integer ratio

Class Name

Basic data handling: FloatAsIntegerRatio

Category
Basic/FLOAT
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

integer ratio Description

Converts a float to an exact integer ratio, providing precise numerator and denominator outputs.

integer ratio:

The FloatAsIntegerRatio node is designed to convert a floating-point number into its exact integer ratio representation. This means that for any given float, the node will return two integers: a numerator and a denominator, which together represent the original float as a fraction. This capability is particularly useful when you need to work with precise fractional representations of floating-point numbers, which can be crucial in scenarios where exact arithmetic is required, such as in certain mathematical computations or when interfacing with systems that require integer inputs. By providing an exact integer ratio, this node helps avoid the inaccuracies that can arise from floating-point arithmetic, ensuring that your calculations remain precise and reliable.

integer ratio Input Parameters:

float_value

The float_value parameter is the floating-point number that you wish to convert into an integer ratio. This parameter is crucial as it serves as the input for the node's primary function. The node will take this float and decompose it into a numerator and a denominator that exactly represent the float as a fraction. The default value for this parameter is 0.0, and it can accept any valid floating-point number within the range of representable floats in Python. The accuracy of the output depends on the precision of this input value.

integer ratio Output Parameters:

numerator

The numerator is the first part of the integer ratio output. It represents the top part of the fraction that, together with the denominator, reconstructs the original floating-point number. The numerator is an integer and is crucial for maintaining the precision of the original float when expressed as a fraction.

denominator

The denominator is the second part of the integer ratio output. It represents the bottom part of the fraction that, along with the numerator, reconstructs the original floating-point number. The denominator is also an integer and plays a vital role in ensuring the accuracy of the fractional representation of the float.

integer ratio Usage Tips:

  • Use this node when you need to convert floating-point numbers to fractions for precise calculations, especially in mathematical or scientific applications where exact values are necessary.
  • This node is particularly useful when interfacing with systems that require integer inputs, as it allows you to maintain the precision of floating-point numbers by representing them as integer ratios.

integer ratio Common Errors and Solutions:

Invalid float input

  • Explanation: If the input provided is not a valid floating-point number, the node may not function correctly.
  • Solution: Ensure that the input is a valid float. You can use Python's float() function to verify and convert inputs to a floating-point number before passing them to the node.

OverflowError

  • Explanation: This error might occur if the float value is too large to be represented as an integer ratio.
  • Solution: Check the range of your float inputs and ensure they are within a reasonable range that can be handled by the system's floating-point arithmetic.

integer ratio 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.

integer ratio