in range
One node instead of a two-comparison tangle
- value
- in_range
Checking whether a number sits between two bounds is one of those things you do constantly in automation - "is this CFG in a sane zone?", "did the step count land in the window?", "is this value valid before I use it?" - and in most node editors it costs you two comparison nodes plus an AND. The NumberInRange node from Basic data handling collapses that whole tangle into one node with one boolean output.
It's the kind of node that looks redundant until you've built one range check by hand, and then you never go back.
How it works
The inputs, straight from the schema:
value- the number to test (FLOAT or INT).min_value- lower bound (FLOAT, default0).max_value- upper bound (FLOAT, default100).include_min- BOOLEAN, defaultTrue: whether the lower bound is inclusive (≥) or exclusive (>).include_max- BOOLEAN, defaultTrue: whether the upper bound is inclusive (≤) or exclusive (<).
Output is a single BOOLEAN named in_range: True when the value is inside the bounds, False otherwise.
Under the hood it's two comparisons ANDed together: value >= min_value (or > if exclusive) and value <= max_value (or <). Nothing more, which is exactly why it's nice to have in one box.
The options that matter
The two include_* toggles are the part beginners miss. With the defaults (both True), a value equal to a bound counts as in range: 50 with bounds 0..100 is True, and so is 0 or 100 exactly. Flip include_max to False and 100 becomes out of range - which is what you want for anything where the max is a "never quite reach" cap, like an index that must stay below a length.
Watch the edge case where min_value > max_value - the node won't stop you, but nothing can be in range, and you'll get False forever. If you're ever tuning a range check and it refuses to return True, check that your bounds aren't swapped.
Where you'd use it
- Guarding a downstream step - only proceed (via a control-flow node) when a value is sane.
- Classifying - map a continuous value into "low / mid / high" buckets with a couple of range checks.
- Validation - a quick assert-style gate before expensive operations.
Installing it
Basic data handling is a zero-dependency pack - no models, no pip installs. ComfyUI Manager → search "Basic data handling" → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart, and in range is under Basic/comparison.
The take
This is one of the pack's genuinely useful "glue" nodes. The exclusive-bound toggles make it fit real edge cases instead of the naive version, and it replaces a three-node pile with something you can read at a glance. If you do any conditional workflow logic at all, you'll use it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT,INT | — | |
| min_value | FLOAT | 0.00 | — |
| max_value | FLOAT | 100.00 | — |
| include_minopt | BOOLEAN | True | — |
| include_maxopt | BOOLEAN | True | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| in_range | BOOLEAN | — |