sqrt
Square roots for when a value needs to be a root
- value
- FLOAT
sqrt returns the square root of a non-negative number - the value that, multiplied by itself, gives you the input. It's a one-input, one-output node from the Basic data handling pack, and it shows up in ComfyUI workflows more than you'd expect, because several practical formulas are built on roots.
The classic one: scaling by area instead of side. If a value represents area (pixels, tile count, coverage), its square root is the linear dimension - so when you want a size knob that feels linear but the underlying math is quadratic, sqrt is the fix. Similarly, RMS-style averaging (root of the mean of squares) is a sqrt, and easing curves often use sqrt or pow(x, 0.5) as the "fast-out, slow-in" shape.
How it works
A wrapper around Python's math.sqrt(). One input, one output:
value- FLOAT or INT, default0. The UI enforces a minimum of0.FLOAToutput - the square root.
Sanity anchors: sqrt(0) = 0, sqrt(1) = 1, sqrt(4) = 2, sqrt(2) ≈ 1.414. Fractions work fine - sqrt(0.25) = 0.5.
The domain rule
You cannot take the square root of a negative number (in real-number math). Python will raise a math domain error, and unlike the input widget's min, a wired-in value that drifts negative will trigger it at runtime. If your input can go below zero, clamp it first - max(value, 0) from the pack's max node, or an epsilon if you need to avoid exact zero. That single troubleshooting step covers 100% of the errors this node can throw.
When you'd grab it
- Perceptually linear sliders for quadratic quantities (areas, resolutions, sizes).
- RMS / averaging math where you want a root-mean-square value.
- Inverse of
** 2- if a formula squares something upstream,sqrtis how you undo it cleanly.
It also pairs naturally with the pack's MathFormula node if you want to combine it with other math in one expression - sqrt(a) is a supported function call there.
Installing it
The whole pack is dependency-free - no models, no pip requirements, nothing to download past the clone. 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 sqrt sits under Basic/maths next to exp and log.
Bottom line
sqrt isn't a node you'll place every day, but the day you're wrestling a quadratic relationship it's the difference between a formula and a guess. Cheap, correct, and it fails loudly (with a clear error) instead of silently - which is all you can ask of a math node.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT,INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |