String to Float
The Float Sibling of String to Int — Same Idea, Decimals Included
- float
Every workflow eventually needs a decimal, and decimal inputs in ComfyUI are floats with a fixed default - they're not where you type things at runtime. String to Float is the pack's version of a text-to-number adapter for the fractional cases: string in, fallback default in, clean float out. It's the decimal sibling of cg_String to Int, and it exists for exactly the same reason - let the user type a number into a text field and keep the graph from dying when they don't.
Where you'll actually reach for it is the denoise knob. The filter nodes' extra text boxes are the natural home for a "denoise 0.4" note, and something like 0.4 needs this node, not the integer version, to become a sampler setting. Pair it with Split String on character and you can type 0.4, 20 into one box and have it feed both denoise and steps - a genuinely pleasant way to adjust an inpaint pass from a single field while you're looking at the result.
How it works
Same shape as the int version:
string- the text to parse. Whitespace is stripped, so "0.4 " parses cleanly.default- the value returned if the string can't be parsed.
Output float is the parsed number or the default. "0.4" → 0.4; "banana" → your default. The try-and-fall-back behavior is the point: a bad string degrades to a sane value instead of throwing an error mid-run.
Installing it
Part of chrisgoringe/cg-image-filter, so it installs with the pack. ComfyUI Manager, search "cg-image-filter" or "Image Filter":
cd ComfyUI/custom_nodes
git clone https://github.com/chrisgoringe/cg-image-filter
Restart ComfyUI. No pip dependencies, no models.
Gotchas
The same rename note as its integer twin applies: this node's class is cg_String to Float because plain "String to Float" collides with other packs. If an old workflow throws a "node doesn't exist" error after an update, delete and re-add it - the README calls this out specifically. And one parsing detail: it expects a plain decimal. If you type "0,4" with a European comma, you'll get the default, not 0.4. The pack's split nodes default to commas, so keep your decimal points literal dots.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — | |
| default | FLOAT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |