LogicUtil_Convert to Float
Force any value into a float, no questions asked
- input1
- FLOAT
ComfyUI is picky about types even when it doesn't look it - a node might want a FLOAT and the graph hands you an INT, or a string that's really a number, and suddenly the wire won't connect or the value silently gets mangled. LogicUtil_Convert to Float takes input1 of any type and coerces it into a clean FLOAT output. It's one of those nodes you don't think about until a type error has you staring at a red wire, and then it's the fix.
How it works
It's Python's float() on the input. For numbers that's a straight conversion: float(3) → 3.0, float(2.7) → 2.7. For numeric strings it parses them: float("2.5") → 2.5. For non-numeric strings it raises a ValueError - float("hello") doesn't become something clever, it fails with a console traceback. Booleans convert too: float(True) → 1.0, float(False) → 0.0, which is occasionally exactly the trick you wanted.
The input defaults to 0, so an unwired input converts to 0.0 instead of blowing up.
Where it fits
- When a sampler or scale node demands a FLOAT and your computed value is arriving as an INT.
- When a text or combo node hands you a number as a string and you need to do arithmetic with it.
- Anywhere you want to guarantee the output type so a downstream type check doesn't reject the wire.
It's one of four Convert nodes in the pack's LogicUtil set (the LogicUtil_ prefix means it's a port of the aria1th LogicUtils nodes) - Convert to Int, Convert to Bool, and Convert Combo to String are its siblings, and they share the same wildcard-in, typed-out shape.
Install
Ships in ComfyUI-JDCN. ComfyUI Manager → Install Custom Nodes → search "JDCN", or:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
pip install -r requirements.txt
Pack dependency is just piexif (plus psutil, already in ComfyUI). No models.
Gotchas
- Non-numeric strings crash it. The node does not silently return 0; it raises and the queue run fails. Check what's on the wire before you convert - this is the node's one sharp edge.
- It doesn't round.
float("3.7")→ 3.7 exactly. If you needed an integer, you want Convert to Int or a Floor/Ceil, not this. - INT → FLOAT is always safe, FLOAT → INT is not - and this node only ever goes to float, which is the safe direction.
Boring utility, zero configuration, does one job cleanly. That's the whole review.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | * | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |