Any to Float
The percent-stripping converter nobody expects
- value
- float
Here's a converter with one quietly smart decision in it. You hand it the string "59.9%" - the kind of value that falls out of a quality-score report - and it gives you 59.9. No crash, no ValueError: could not convert string to float.
Any to Float is one of the three primitive adapters in Orel's Nodes, DarkOrel's utility pack. Wildcard in, FLOAT out, and it accepts more shapes of input than you'd guess.
What it accepts
The input socket is * (ComfyUI's IO.ANY wildcard), so validation won't stop you. Then:
- int or float → straight through
- bool →
1.0or0.0 - numeric STRING → parsed with
float(), after trimming whitespace - one trailing
%→ stripped before parsing, so"59.9%"→59.9and"0.85 %"→0.85 - empty or whitespace-only string → raises, with a message that says so
- None → raises
- NaN → raises
- anything else (IMAGE, MODEL, LATENT, a dict) → raises, naming the type it got
That percent strip is the interesting part. The pack's own face-similarity node emits a percentage output that's literally score * 100, and its verdict strings are meant to end up in filenames and status lines. So the converter is built to accept "59.9%" as a number without asking you to add a text-processing detour.
Inputs and outputs
value(required, type*) - the value to convert.- float (FLOAT) - the result.
Why you'd want it
The public justification for the whole wildcard-converter family is repetition: you have one number and three nodes that want it in three types. Rather than duplicating the source or hand-editing three widgets, you branch once. This is the pattern the ecosystem's plumbing reference describes as the value-node principle - one authoritative source, many consumers.
In practice, per-node, you'll use it for two things:
Adapters. A node emits INT, the next one insists on FLOAT. Or a string arrives from a text node and a sampler wants a number.
Normalising scores. Percentage strings, values with stray whitespace, "0.6" from a config file - they all land as clean floats.
Install
ComfyUI Manager → search Orel's Nodes → Install → restart → hard-refresh the browser.
Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/DarkOrel/Orels-Nodes.git orels-nodes
python -m pip install -r orels-nodes/requirements.txt
Restart and hard-refresh. The primitive nodes don't use anything from that requirements file - it's there for the pack's Hugging Face download features. If you never touch those, the primitives still load fine.
Gotchas
inf gets through. The only non-finite guard is on NaN. float("inf") and "-inf" parse happily and will travel downstream as infinity until something multiplies by zero and you get a NaN anyway. Rare, but if a sampler starts producing black images for no reason, check whether a converted value went infinite.
One percent sign, at the end, only. "50%%" or "50% off" won't parse. Neither will "1,024" - thousands separators are not handled, which surprises people pasting from spreadsheets.
It never rounds. "59.997" gives you 59.997. If you need a clean two-decimal value for a filename, do that somewhere else - this node's contract is "parse it faithfully," and quietly truncating would be a worse bug than an ugly filename.
Watch what you wire into it. The wildcard socket accepts a LATENT. It will try to convert it, fail, and the error will name the type. Useful, but the failure still lands at run time, not at wiring time.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |