Is Number
So, Is That Value Actually a Number?
- value
- boolean
ComfyUI will happily feed you a string that looks like a number, a tensor that isn't one, or a boolean pretending to be an int. Is Number is the gatekeeper that tells you the truth: wire anything into it, and it outputs a clean BOOLEAN - true if the thing is actually a number, false otherwise. Feed the boolean into a switch, a conditional router, or a Python-like logic chain and you get branching behavior without any fragile parsing.
It's from artyclaw/artyclaw-comfy, the author's prompt-logic/IO/RNG toolkit. The class name (IsNumberNode) and display name ("Is Number") both stick, and there's a subtle correctness decision baked into the source worth knowing about.
How it works
The input is typed * - a wildcard type that accepts literally anything in ComfyUI, from an IMAGE to a STRING to a FLOAT. Then the logic runs:
- A boolean (True/False) →
false. Python treats bool as a subclass of int, so without this checkTruewould count as a number. The author explicitly excludes it. - An int or float →
true. - A string → tries
float(value)."42"and"3.14"pass;"forty-two"fails. - Anything else - tensors, images, latents, lists →
false.
The edge cases are the interesting part. A string "nan" will pass the float() check and count as numeric, because float("nan") succeeds - so if your pipeline can produce NaN, remember this node answers "is it castable to a number," not "is it a sane number."
Inputs and output
One input, value (wildcard * type). One output, boolean (BOOLEAN). Wire the output into any node that takes a boolean - logic routers, switches, or an If-style conditional. Typical use: a loader or API returns a string, and you branch on whether it parsed as a number before doing math on it.
Install
ComfyUI Manager → search ArtyClaw Comfy Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/artyclaw/artyclaw-comfy
Restart. Pure Python, no dependencies.
Where people get burned
The bool-vs-int distinction catches people: True is famously an int in Python (True == 1), and this node deliberately returns false for it, which is usually what you want but worth knowing if you're checking a value that genuinely is a boolean. The string-cast behavior is the other trap - " 5 " (with spaces) passes, and "1e3" passes as 1000.0, because float() is permissive. If you need "is this a nice clean integer," this isn't the node; if you need "can I safely treat this as numeric," it's exactly right. For a one-output logic utility it's about as straightforward as this pack gets.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| boolean | BOOLEAN | — |