Float Unary Operation JK๐
Thirty-two math functions on a single float
- FLOAT
CM_FloatUnaryOperation is the pack's one-float Swiss Army knife: an op dropdown with 32 operations on input a, returning a FLOAT. If you need a math function and this pack has it, it's probably here - trig, logs, rounding, even error functions.
What's in the menu
- Arithmetic: Neg, Inc (+1), Dec (โ1), Abs, Sqr, Cube
- Roots & powers: Sqrt, Exp, Ln (natural log), Log10, Log2
- Trig: Sin, Cos, Tan, Asin, Acos, Atan
- Hyperbolic: Sinh, Cosh, Tanh, Asinh, Acosh, Atanh
- Rounding & truncation: Round, Floor, Ceil, Trunc
- Special: Erf, Erfc (error functions), Gamma (the gamma function), Radians, Degrees
The honest gotchas
This node is a thin wrapper over Python's math module, which means domain errors are real and they crash the queue rather than returning a graceful value:
- Sqrt of a negative raises. So do Ln/Log of zero or negatives.
- Asin/Acos only accept inputs in
[โ1, 1]- feed it 2 and it throws. - Acosh needs
a โฅ 1, Atanh needsโ1 < a < 1. Tan of a multiple of ฯ/2 explodes toward huge values, which then poison anything downstream. - Gamma of a non-positive integer raises too.
So: if the value feeding this node comes from anything that can go out of range (a sampler output, a schedule, a slider), clamp it or guard it first. The pack's CM_FloatUnaryCondition is the guard - check IsFinite or IsNaN before the value reaches the math. In practice the useful 90% is Abs, Sqr, Sqrt, Round, and the trig for oscillating schedules (Sin on a counter makes a smooth up-down strength curve).
Installing it
Part of ComfyUI-JakeUpgrade:
cd ComfyUI/custom_nodes
git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
cd ComfyUI-JakeUpgrade
# Windows standalone: install.bat
# or: python_embeded\python.exe -s -m pip install -r requirements.txt
pip install -r requirements.txt # non-Windows
Or ComfyUI Manager, search "JakeUpgrade", install, restart. Nothing to download.
Gotchas
- Domain errors stop the whole queue. This is the node's biggest trap; guard inputs or clamp before math.
- Round/Floor/Ceil return floats here, not ints - there's no silent type conversion, so route through CM_FloatToInt if a downstream node insists on integers.
- Manager's JakeUpgrade / IPAdapter_plus conflict warning is a false positive from the pack's
replacement/folder. - ComfyUI-MultiGPU causes CUDA errors with recent ComfyUI - disable it per the README.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| op | COMBO | Select unary mathematical operation | |
| a | FLOAT | 0.00 | Input float value |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | โ |