Int and Float
One number, two sockets, and why 2.9 quietly becomes 2
- int
- float
Every ComfyUI graph eventually hits a socket that insists on an integer while the number you care about lives on a float wire - or the reverse, where you want the same magnitude to feed a FLOAT socket and an INT socket without typing it twice. Int and Float is the smallest possible answer to that: a float box in, an INT and a FLOAT out.
There's no secrecy in it, but know one behaviour before you trust the integer output.
The mechanism
def process(self, value):
return (int(value), float(value))
Python's int() truncates toward zero. It does not round. So 2.9 gives you 2, 2.1 gives you 2, and -1.5 gives you -1. If the value arrives from a math node and is notionally 3 but lands at 2.9999999999, you'll get 2 - an off-by-one that shows up as a one-pixel size difference, or a step count a whole step short. Compute it upstream and you own the rounding problem at the source.
Why you'd reach for it
ComfyUI's type system is strict in a way that is mostly a gift. An INT socket will not accept a FLOAT wire, so a value that is obviously an integer to you still needs a node in between.
The other half is repetition. The plumbing layer exists to fight two things - repetition and illegibility - and "the same value in more than one place" is the classic case: one value fanned out to both a FLOAT consumer and an INT consumer beats typing the number into two widgets and forgetting the second. Core has typed primitives (PrimitiveInt, PrimitiveFloat, and friends) and they're the right tool when you want one value in one type. What they can't do is hand the same number to two different types at once. That's the gap this fills.
Two smaller conveniences come free from how the pack writes it. value is a plain widget, so right-click → Convert widget to input turns it into a socket you can drive from a primitive or a math node - one upstream number now controls both types, and the wiring says so. And the default is 1.0, so a freshly dropped node sits at 1 and 1.0: benign for a multiplier, dangerous for anything counted - one batch, one step. Set it before you wire it.
Where it shows up in practice: plumbing a scale factor into a size input, or keeping a steps value synced between a FLOAT-configuring node and an INT sampler field. It's not glamorous, which is the point - it's the node you drop in when you'd otherwise hunt a 200-node graph for whatever upstream node happens to emit INT.
Inputs and outputs
value- FLOAT, default 1.0. The required, and only, input.int- INT. The truncated value.float- FLOAT. The same value, untouched.
Wire float where a node wants a float, int where it wants an integer. They're independent outputs - use either, both, or leave one dangling.
Install
This is one of five nodes in Mochorong, a small one-person utility pack (author mochorongo, MIT, v1.0.1). It has essentially no community footprint, which for a node this size is neither a red flag nor a selling point - it's a converter.
Via ComfyUI Manager, search Mochorong and install; or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/mochorongo/Mochorong
Restart ComfyUI afterwards - custom nodes are loaded at startup, so cloning while it's running means nothing appears until you do. The README's registry one-liner is comfy node install comfyui-mochorong.
No dependencies to fight with: there's no requirements.txt, no model files, nothing to download. The pack imports torch, numpy, PIL and folder_paths, every one of which already ships with ComfyUI. Python 3.10 or newer, per its pyproject.toml. The node appears under the Mochorong category. If it doesn't, check the clone isn't nested (custom_nodes/Mochorong/Mochorong breaks it - the .py files need to be directly in custom_nodes/Mochorong/).
The troubleshooting short list
- "Return type mismatch" or a refused connection. You're trying to plug
floatinto an INT socket. That's what theintoutput is for. - Off by one. Truncation, not rounding. Round upstream if the difference matters.
- The graph didn't change when you edited the number. You probably converted
valueto an input and there's still a value wired to it; the widget no longer decides anything. - It works but you don't need it. Fair. If you have one float and one int consumer, two core primitives do the same job with an explicit type each. This node saves you exactly one node and one opportunity for the two numbers to drift apart.
Sources: Mochorong intfloat_node.py, pyproject.toml and README (read 2026-09-14); docs/knowledge/comfyui-node-plumbing.md for the typed primitive nodes, the convert-widget-to-input mechanic, and why the value/logic layer exists; docs/knowledge/comfyui-ecosystem.md for Manager and custom-node install expectations.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT | 1.00 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| int | INT | — |
| float | FLOAT | — |