Square Root
Square root, and it will tell you when you've gone negative
- a
- result
WtlSqrt takes a number, computes its square root, and hands it back as a float. That's the whole node - and honestly, the whole reason it's useful is the single decision it makes for you: the output is always a FLOAT, even if you feed it a perfect square. Feed it 9 and you get 3.0, not 3. That matters in ComfyUI, where an int result would refuse to connect to a float-only socket; knowing the output type is guaranteed means you can wire it anywhere without surprises.
Input is a single a socket accepting INT or FLOAT. That's it. No sliders beyond the default 0, no mode dropdowns, no preview system. It's the pack's no-frills math leaf.
Where does a square root actually come up in a generation workflow? Rarely, but it's not academic. It shows up in noise or strength math where you're computing distances or scaling factors, and occasionally in resolution arithmetic - some upscale formulas use a sqrt to split a multiplier between width and height. If you build math chains with the pack's other logic nodes, WtlSqrt slots right in: its input is the same INT,FLOAT union socket the others use, and its output plugs into anything expecting a float.
The one trap is grounded in the code: feed it a negative number and it raises ValueError - the message is prefixed [WtlSqrt] so it's findable, but the workflow just stops. There's no imaginary-number hand-waving. If your value can go negative, clamp it upstream with a min before it reaches this node.
It's part of the WtlNodes pack (Scorpiosis0/ComfyUI-WtlNodes), so install the pack once. ComfyUI Manager, search "WtlNodes":
cd ComfyUI/custom_nodes
git clone https://github.com/Scorpiosis0/ComfyUI-WtlNodes.git
restart ComfyUI. Dependencies are numpy, scipy, and pillow; no models, no keys. A one-trick node, but the trick is implemented with type-correctness in mind, which is more than stock math nodes offer.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT,FLOAT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | FLOAT | — |