Convert To Float
When \"0.75\" Shows Up as Text, Not a Number
- input
- output
The denoise-from-a-prompt problem
The values that tune a generation - denoise strength, CFG scale, LoRA weight, the strength on a detail pass - are almost all floats. And the values that come out of the automation layer around ComfyUI - an LLM's recommendation, a JSON payload, an API response - are almost all strings. "Use denoise 0.55" arrives as the text "0.55", and the sampler's FLOAT port will not touch a STRING wire. That's the exact gap Convert To Float exists to fill.
It's one of four nodes in the ComfyUI-TypeConverters pack, and it's the sibling of Convert To Integer with a decimal point. Same shape: one ANY input, one strongly typed output, no configuration. It takes whatever the graph hands it and returns a proper FLOAT that CFG, denoise, and strength ports actually accept.
How it works
The conversion tries the direct float cast first, then falls back to text parsing:
- Numbers convert cleanly:
6becomes6.0,Truebecomes1.0,Falsebecomes0.0. - Text gets parsed:
"6.5"becomes6.5,"6"becomes6.0. - Strings that read as yes or no are honored:
"true","yes","y","on"→1.0;"false","no","n","off"→0.0. - Anything unparseable -
None, garbage text, unexpected objects - quietly becomes0.0.
Unlike its integer sibling, there's no truncation drama here: 6.9 stays 6.9. The only real surprise is that same safe-default behavior - a bad input silently becomes 0.0, which for a denoise value means the sampler treats it as essentially no denoising. That's a silent workflow change, not a crash, so it's worth keeping an eye on when you see unexpectedly sharp output.
The inputs and outputs that matter
- input (
ANY) - accepts any wire, which is what lets it bridge mismatched types without you hunting for the right adapter. - output (
FLOAT) - a real decimal number, ready for denoise, CFG, strength, or any other float port.
Use it any time a number you need for a generation setting arrives as text - the classic case being an LLM choosing a CFG value and returning it as a sentence fragment you've coaxed into "7.5".
Installing it
ComfyUI Manager: search "ComfyUI-TypeConverters" and install. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/zfrsgtcu/ComfyUI-TypeConverters
Restart ComfyUI and the node appears under zfr-nodes. The pack has no model downloads and no dependencies - it's a single Python file, so there's nothing to go wrong at install time beyond forgetting to restart.
The takeaway
Convert To Float is the boring node that quietly makes dynamic workflows work. If your LLM-driven or API-fed graph keeps throwing red wires at denoise or CFG ports, this is the fix - and unlike fiddling with string-to-number hacks inside text nodes, it's a first-class, cacheable part of the graph. Just remember the 0.0 fallback and you're set.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | FLOAT | — |