Float Binary Operation JK๐
Do real math on your floats without a calculator node
- FLOAT
Every interesting workflow eventually needs to compute a number: a denoise strength that's a fraction of the steps, an upscale factor, an aspect-ratio-corrected dimension. Float Binary Operation JK is the two-input calculator for that. Pick an operation, feed it two floats, get one float back. Nothing fancy, but it's the workhorse that keeps you from hardcoding values into every sampler.
How it works
You pick an op from a dropdown and supply a and b. The operations are straightforward math: Add, Sub, Mul, Div, Mod, Pow, FloorDiv, Max, Min, Log, Atan2. It applies the selected one and returns the result.
Two gotchas live in the dropdown:
Logis log basebofa, not natural log.op=Log, a=100, b=10gives you 2.Divby zero throws an error rather than returning infinity. The node raises aValueErrorwith a message naming the operation and the offending values, so you'll see exactly where the graph broke. It's a deliberate choice - silentinfflows are how you get garbage downstream and spend an hour hunting it.
Inputs and outputs
op- the operation dropdown.a- first float.b- second float.FLOAT- the single output.
The classic patterns: Mul a base resolution by a scale factor, Div to split a budget across passes, Min to clamp an aggressive number against a sane ceiling. Because the output is typed FLOAT, you'll usually run it into Float To Int JK before feeding latent dimensions or steps.
Installing it
Ships in ComfyUI-JakeUpgrade:
- ComfyUI Manager โ search "JakeUpgrade" โ install โ restart.
- Or:
cd ComfyUI/custom_nodes
git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
cd ComfyUI-JakeUpgrade
pip install -r requirements.txt
Windows portable: run install.bat or ../../../python_embeded/python.exe -s -m pip install -r requirements.txt.
Common issues
- Division by zero kills the run. If
bcan be zero at runtime (say it comes from an unconnected or empty input), the node errors. Guard it with aMaxofbagainst a tiny epsilon, or clamp the input upstream. - Operation names aren't obvious for the exotic ones.
FloorDivis integer floor division (useful for chunking),Atan2is the two-argument arctangent (mainly if you're doing angle math). If you're not doing angle math, you'll live inAdd/Mul/Div/Min/Max95% of the time.
It's not a replacement for a full math suite - no trig on single values beyond Atan2, no variable storage. But as a drop-in calculator node that shares a pack with JakeUpgrade's parameters and switch nodes, it keeps your numbers computed instead of typed, which is exactly what a maintainable workflow wants.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| op | COMBO | Select binary mathematical operation | |
| a | FLOAT | 0.00 | First float input |
| b | FLOAT | 0.00 | Second float input |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | โ |