Nodes/ComfyUI-GeN13/Number (GeN13)
ComfyUI Node

Number (GeN13)

One value, three types, and a format field that fixes your prompt

By heigen13·Created 23 days ago·Updated 11 days ago· 1
Number (GeN13)
  • number
  • INT
  • FLOAT
  • STRING
◄value0.000►
◄control_after_generatefixed►
◄to_intround►
◄format►

ComfyUI's type system is fussier than it looks. A node hands you a FLOAT, and the socket downstream wants an INT. Or you've got a number living inside a string - an LLM wrote "duration: 11" and you need the 11. Or you want the number in the filename as 7.5 and the STRING output of everything else keeps giving you 7.500000.

Number (GeN13) is the small adapter for all three. One value in, the same value out as INT, FLOAT and STRING simultaneously, with the rounding and the text formatting under your control.

What you set

  • value - the number itself. Accepts up to six decimal places. Not used when number is connected.
  • control_after_generate - fixed, increment, decrement, randomize. Same semantics as the seed widget, and yes, the usual warning applies: the control fires after a run, so the value shown in the box is the one the next queue will use if you're incrementing. Set it to fixed unless you mean it.
  • to_int - round, floor, ceil. This only affects the INT output; the FLOAT output is always the exact value. Worth being deliberate about: floor on a positive number is the same as truncation, but on a negative value it isn't, and round on .5 isn't the rounding you learned in school.

Optional inputs:

  • number - accepts INT, FLOAT or STRING, and replaces value when connected. This is the interesting one: it makes the node a parser. Feed it Show Any's STRING output and a number embedded in text becomes a number.
  • format - a template for the STRING output. {} gets replaced by the value; with no {}, the value is appended to whatever you wrote. So duration: gives you duration:11, and {} sec gives 11 sec. Empty means value only.

The outputs

All three at once, so you pick per-consumer rather than per-node:

  • INT - rounded per to_int.
  • FLOAT - the original value, untouched.
  • STRING - trailing zeros stripped (7.50 → 7.5) with format applied. This is the one that goes into filename prefixes, note nodes, CLIP Text Encode, or a Counter's reset input.

Because all three exist on one node, the common little tangle - "I need this as text in the filename and as an integer in the sampler" - stops being two nodes and a converter.

Where it earns its place

Three patterns I'd actually use it for:

Parsing LLM output. An LLM writes a script with a duration in it. Show Any dumps the text. You need the number for Remote Video's seconds or for a frame count. Show Any's STRING → Number's number → FLOAT out. Text that can't be converted gives 0, which is a quiet failure mode worth knowing about - check the output the first time.

Labelling a series. Counter's INT into number, format set to something like shot_, is a one-node filename prefix for a batch where each render knows its own index.

Taming float noise. A calculated value of 0.30000000000000004 in a note or a prompt looks like a bug. Pass it through, to_int round, and you get clean readable output.

Installing

Manager → search GeN13 → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/heigen13/ComfyUI-GeN13
pip install -r ComfyUI-GeN13/requirements.txt

The one dependency, nvidia-ml-py, is for the pack's monitor strip beside the Run button - not for this node. Number is pure Python with no imports worth mentioning. Portable builds: use python_embeded\python.exe -m pip.

Fine print

format only affects STRING. If you set format and then wire the INT output, nothing changed and nothing will.

And the STRING output trims trailing zeros but doesn't pad: 7 stays 7, not 7.0. If you need fixed decimals for a filename sequence, do the padding in the prefix (Save Image Private's counter padding) rather than hoping the number node does it.

If all you need is a number to fan out to five nodes, core's primitive nodes do that with one widget and no options. Number is for when you need the other type of the same value - which, in graphs with video lengths, frame counts and prompt templates in them, is most graphs.

CategoryGeN13/utils

Inputs (5)

NameTypeDefaultDescription
valueFLOAT0.000-1000000000–1000000000Value: an integer or decimal, up to six decimal places. Not used when number is connected.
control_after_generateCOMBOfixedAfter generate: fixed keeps the value, increment adds 1, decrement subtracts 1, randomize picks a random integer.
to_intCOMBOroundRounding: round to nearest, floor rounds down, ceil rounds up.
numberoptINT,FLOAT,STRINGNumber input: accepts INT, FLOAT or STRING and replaces value; text that cannot be converted gives 0.
formatoptSTRINGFormat: template for the STRING output; {} is replaced by the value. Without {}, the value is appended; empty outputs the value only.

Outputs (3)

NameTypeDescription
INTINTInteger: rounded as set in to_int.
FLOATFLOATDecimal: the original value as FLOAT.
STRINGSTRINGText: trailing zeros removed, such as 7.50 → 7.5; format applied if set.