ZML_整数浮点互转
The one-node type bridge for numbers
- 浮点数
- 整数
ComfyUI is strict about types. An INT socket won't take a FLOAT, and when a node's strength slider needs a float and your workflow only has integers, you hit a wall that isn't a wall - it's a missing converter. ZML_IntegerFloatConverter (ZML_整数浮点互转, "integer-float interconvert") is the two-cent part that fixes it: integers in, floats out, and the reverse.
It's from ComfyUI-ZML-Image, zml-w's 160+ node pack, added in the October 2025 update alongside its boolean and string converter siblings. It lives in the pack's integer subcategory.
How it works
Two optional inputs, two outputs:
- 整数 (INT) in → 浮点数 (FLOAT) out: the integer promoted to a float. No rounding, no surprises.
- 浮点数 (FLOAT) in → 整数 (INT) out: the float truncated with Python's
int(). This is the one gotcha - it truncates toward zero, it does not round.3.9becomes3,-2.7becomes-2. If your workflow depends on rounding, do it before you hit this node.
Both inputs are optional, and the node converts whichever side is connected. Wire only an integer and you get its float version; wire only a float and you get its integer version. The pass-through behavior is the same one shared by its siblings: it's a bridge, not a calculator.
When you'd use it
Anywhere a numeric type boundary bites you. A KSampler's CFG wants a float but your preset chain produces ints. A resolution node hands you width/height as floats and the EmptyLatent downstream wants ints. A switch or logic node emits a float and your integer-driven selector needs a whole number. It's the plumbing layer's answer to "wrong type, two sockets apart."
It's also genuinely useful inside this pack's own vocabulary, where integer nodes (ZML_LimitResolution and friends) and float-based controls talk to each other constantly.
Installing it
Pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
restart ComfyUI, or ComfyUI Manager → search "ComfyUI-ZML-Image". Pure Python, no models, no extra dependencies.
When you don't need it
If you're not already running this pack, core ComfyUI's own primitive nodes plus the type coercion you get from "Convert widget to input" usually cover this - and for a one-off, right-click a widget and convert it to a socket rather than adding a node. But once the pack is installed, this converter is the one you reach for without thinking, because it's already on the menu and it does exactly one boring thing correctly.
The truncation thing is worth repeating because it's the only way this node can bite you: float to int is a floor-move-toward-zero, not a round. Keep your floats tidy on the way in and you'll never notice.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| 整数opt | INT | — | |
| 浮点数opt | FLOAT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 浮点数 | FLOAT | — |
| 整数 | INT | — |