set it as float type
When your cfg or denoise arrives as an any-value
- a
- Float
Half the knobs you actually turn in a generation are floats - cfg scale, denoise, strength - and floats are exactly the values that get pushed through any-typed plumbing when you build a workflow with a control panel. "Set it as float type" is the pass-through that tells ComfyUI "this is a float, wire it in as one."
Same mechanism as every node in this pack: exec(self, a=None): return (a,). The value on a passes through unchanged, and RETURN_TYPES = ("FLOAT",) re-labels the output. Wire it into a cfg or denoise input and the socket accepts the connection again. There's no rounding, no casting - if the wire is carrying 7.5, that's what comes out, now labeled FLOAT.
The trap is the same one its sibling (as int) has, inverted: a FLOAT label is a stricter promise than a NUMBER label. If what's actually on the wire is 7 (an integer), you've just labeled it FLOAT without converting it, and a node that does strict float math on it may not care - or may blow up, depending on how careful the node is. The rule is embarrassingly simple: use as float only when it's actually a float. Use as int when it's an int. Use as number when you're not sure and the destination is flexible.
When you'd reach for it
- A cfg, denoise, or strength value comes from a primitive/switch/API as
*and a typedFLOATinput refuses the wire. - You're building one of those UE-style control graphs this pack exists for (the README: "enhance use cg-use-everywhere").
And the honest footnote: if you just want to convert numbers, ComfyUI's built-in Convert Float / int-to-float nodes actually transform the value. This node only re-labels it. Different tools, different jobs - don't use the sticker where you need the converter.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/YMC-GitHub/ymc-node-as-x-type
or via ComfyUI Manager (search ymc-node-as-x-type), restart. No models; the four yors_* pip deps auto-install on startup. Find it by double-clicking and typing set it as, or right-click → YMC → LINK.
Gotchas
- Label only - no casting. Float-label an integer and you've made a promise the data doesn't keep.
- One-commit, single-maintainer pack (v0.1.2, 2025). A small utility, lightly maintained.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| aopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Float | FLOAT | — |