Float math
One float-math node that can replace a whole tower of Math nodes
- FLOAT
Float math is the gateway drug to the More Math pack. It takes up to eight floats and runs a single math expression over them, so instead of a daisy chain of "Math", "Combine", and "Clamp" nodes you get one box with one line of math. The default expression is a*(1-w)+b*w - a linear interpolation between a and b by weight w, which is the same lerp you'd build out of three nodes by hand. It's a calculator with a very long list of functions.
What you can actually write in there
The expression language is the whole point, and it's a proper language, not a toy: + - * / % ^, comparisons, and a function list that goes well past sin and cos. clamp, lerp, smoothstep, remap, round, floor, fract, log, exp, pow - all there. You can even define your own variables and functions inside the expression:
steps_eff = round(a * 0.75);
clamp(steps_eff, 10, 40)
The rule of thumb the author uses: the last part of the input must be the expression that produces the result. Anything before it can set up variables and helpers. No loops needed for 99% of what you'll do here.
The inputs that matter
a- required float, the anchor.b,c,d- optional floats, default 0.w,x,y,z- four more floats, all default 0. That's your eight inputs total.FloatFunc- the expression. Defaulta*(1-w)+b*w.
Output is a single FLOAT. Common real uses: computing a denoise strength from a slider, deriving a CFG value, scaling a seed, or feeding a lerped value into anything that takes a float.
Installing it
It ships in the More Math pack. Via ComfyUI Manager, search "More Math" and install; or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/mcDandy/more_math
cd more_math
pip install -r requirements.txt
Restart, and it's under the "More math" category. Dependencies are just antlr4-python3-runtime and torch - no downloads. Note the pack targets a current ComfyUI (it uses the newer node API), so if nothing appears after install, update ComfyUI first.
Where people get burned
The most common failure is a typo in the expression - the node turns red and you get a parse error, not a helpful message pointing at the exact character. Double-check function names (it's clamp(x, min, max), smoothstep(x, e0, e1)).
The second gotcha is ^. In this pack ^ is power, not XOR - so 2^3 is 8, and if you came from a language where ^ is XOR you'll get surprising numbers. And remember the output is a plain scalar: if you feed it a tensor-y input it'll flatten down to one value, which is usually not what you meant.
One thing to know before you build your whole workflow on the exact node here: this classic form is deprecated in the pack source. The pack also ships an autogrow version with the same "Float math" display name, which gives you up to 50 V0..V49 float inputs instead of the fixed eight. Same expression language, so anything you learn here transfers. Search the node menu and you'll likely see both - the one you want for a fresh workflow is the autogrow one, but this classic still works fine.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| a | FLOAT | — | |
| FloatFunc | STRING | a*(1-w)+b*w | Expression to use on inputs |
| bopt | FLOAT | 0.00 | — |
| copt | FLOAT | 0.00 | — |
| dopt | FLOAT | 0.00 | — |
| wopt | FLOAT | 0.00 | — |
| xopt | FLOAT | 0.00 | — |
| yopt | FLOAT | 0.00 | — |
| zopt | FLOAT | 0.00 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |