比较数值🐠meeeyo.com
Classify a number as small, medium, or large — then route on the label
- any
- STRING
CompareInt is the pack's number-bucketing node: you give it a number and a range, and it tells you whether the number is below the range, inside it, or above it - as a STRING label. It's part of MeeeyoAI/ComfyUI_StringOps, and despite the name it takes a float, so it's happy comparing CFG values, denoise strengths, batch sizes, or any fractional number a workflow produces.
The output is one of three Chinese labels: 小 (small - below the range), 中 (medium - inside it), 大 (large - above it). That's the whole contract. You feed in a number and a range like 3.5-5.5, and the node buckets the number for you.
The inputs
- input_float - the number to test (default 4.0). FLOAT type, so decimals are fine.
- range - the bounds as a string, default
3.5-5.5. A dash means an inclusive range: below the lower bound is 小, between them (inclusive) is 中, above the upper bound is 大. A bare number with no dash - say5- treats the range as a point, and "medium" means exactly equal.
There's also a wildcard any input that accepts anything and does nothing functionally - the pack author's habit for forcing execution order in the graph.
How to use it
The real value is in routing. Combine the label with a Switch: "if the denoise strength is high (大), go down the heavy-upscale path; if medium (中), use the default; if low (小), skip." Or classify a seed's size to pick from different prompt banks. Because the output is a string, it also reads naturally in a text log - you can stamp a run with "batch size: 大" without any parsing.
The gotchas
- The labels are Chinese, and they come back verbatim - if your downstream switch expects English strings, you'll need to map them. That's a small annoyance but a real one for non-Chinese-reading users.
- Boundary behavior: the range is inclusive, so a value exactly on the edge counts as 中.
input_floatequal to 3.5 or 5.5 lands in the middle bucket, which is the common expectation but worth stating. - Bad input (no dash and not a number, like
abc) returns the stringError: Invalid input format.rather than crashing - visible, at least, unlike some pack nodes that fail silently. If you see that string coming out, fix the range field.
It pairs naturally with CountOccurrences (count a token's occurrences, then classify the count) and with TextConditionCheck's INT output if you'd rather bucket on a condition result than compare a raw number.
Installing
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
or via ComfyUI Manager searching ComfyUI_StringOps, then restart. Under "Meeeyo/Number". No models, no dependencies to install.
It's a one-comparison node that turns a raw number into a named bucket - modest, but exactly the kind of primitive that keeps branching workflows readable instead of buried in arithmetic.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input_float | FLOAT | 4.00 | — |
| range | STRING | 3.5-5.5 | — |
| anyopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |