to number
Turn a text number into three typed outputs (read the gotcha first)
- number
- float
- roundInt
ComfyUI workflows love to pass numbers around as strings - prompt-extracted values, filenames, config text. Eventually something wants a real NUMBER, FLOAT, or INT socket. To number is the bridge: it takes one STRING and emits it three ways at once - number, float, and roundInt - so you can grab whichever type your downstream node demands without re-casting.
It sounds trivial, and mostly it is. But there's a trap baked into the implementation that you'll hit the first time you feed it a decimal, so read the gotcha before you wire it up.
How it works
The node runs three conversions on your text:
- number -
int(text) - float -
float(text) - roundInt -
int(round(float(text)))
The outputs are ordered number, float, roundInt. For an integer string like "42" all three agree (42, 42.0, 42). For a decimal string like "3.7", the story changes: float gives 3.7, roundInt gives 4, but number - int("3.7") - throws a ValueError. Python's int() doesn't accept decimal-point strings. So the number output is only safe for integer-formatted text, and a decimal string will make the whole node error, not just that output.
Inputs and outputs
- text - STRING, the numeric text, default
"" - Outputs: number (NUMBER), float (FLOAT), roundInt (INT)
Installing it
# ComfyUI Manager: search "ymc suite" and install ymc-node-suite-comfyui
# or:
cd ComfyUI/custom_nodes
git clone https://github.com/YMC-GitHub/ymc-node-suite-comfyui
Restart after installing. Dependencies are four small pure-Python PyPI helpers that self-install; no models, no GPU footprint.
Gotchas
- Don't feed decimals if you only need the
numberoutput.int("3.7")crashes the node. For decimal text, reach for thefloatorroundIntoutputs, which handle it fine. - Empty text errors too -
int("")is aValueError. Give it a real default or guard the source. - The is round to x / switch a and b (isRoundTo) nodes do their rounding internally and take strings directly. If your only goal is a rounding comparison, you can skip this conversion entirely.
- WAS-conflict note as with the rest of the pack: if WAS Node Suite is installed too, Manager may flag shared node names between the packs.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| number | NUMBER | — |
| float | FLOAT | — |
| roundInt | INT | — |