_.isFloat
An exact-type float check that numpy will trip over
- obj
- *
_.isFloat checks whether an object is a float - and like _.isInt, it does it with an exact type check: type(self.obj) is float. In the sfinktah/comfy-ovum pack's ovum/underscore family (auto-generated wrappers around underscore3, a Python port of Underscore.js), this is one of the straightforward ones. The only reason to think twice is what ComfyUI actually hands you when it says "this is a float."
The family's README caveat is the usual one: work in progress, "not recommended for use in workflows." For a one-line type check that's mostly noise, but it's worth remembering these nodes are auto-generated and uneven - which is exactly why this one and its exact-type siblings behave the way they do.
What it does
The check is type(self.obj) is float. Exact type, no isinstance. So:
- A plain Python
floatlike1.5or0.0→True. - An
intlike1→False(different type, even though1.0 == 1). - A
bool→False. - A
numpy.float32ornumpy.float64→False. This is the real gotcha. ComfyUI is built on torch and numpy, and a lot of computed values - CFG schedules, timesteps, anything a custom node math'd up - arrive as numpy floats or even 0-d tensors. Those are not the Pythonfloattype, so_.isFloatsaysFalsefor values that are unmistakably floats.
If your floats only ever come from ComfyUI's FLOAT widgets, this works perfectly. The moment they come from a computed path, expect the check to lie.
Like everything in the family, feed it a plain value and get the boolean back, or feed it a _.CHAIN from _.chain and it runs on the wrapped object, passing the chain onward.
Inputs and outputs
obj- the only input, type*, optional.- Output - a single
*socket holding a Python bool. Standard family quirk: the value is a real boolean, the socket type is generic.
Where it fits
Type validation and debugging, mostly. If a dynamic node can hand back either a number or a string and you need to distinguish them, _.isFloat tells you "this is a genuine Python float." If you're debugging why a numeric input isn't behaving, checking the exact type off the wire is genuinely useful - you'll often find the value is a numpy scalar that's masquerading as a float.
For "is this a number at all" questions, _.isFloat is narrower than you want; for "is this exactly a float," it's exactly right.
Installing it
Install the pack via ComfyUI Manager - search comfy-ovum - or:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
Restart ComfyUI. underscore3 is vendored in the repo, so no extra install for this node.
Gotchas
- numpy float32/float64 and 0-d torch tensors read as
Falseeven though they're floats. The exact-type check is the whole behavior. 1.0is a float,1is not - the value doesn't matter, the type does.- Output wire is
*, notBOOLEAN.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| objopt | * | Primary input object. Also accepts _.CHAIN to continue chaining. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |