NumberUnaryOperation
Negation, roots, logs, and trig for one value
- NUMBER
Where NumberBinaryOperation takes two values and combines them, NumberUnaryOperation takes one value and transforms it - and it packs in 32 different operations to do it, by far the biggest dropdown anywhere in ComfyMath. The visible dozen already spans negation (Neg), increment/decrement (Inc/Dec), absolute value (Abs), squares and cubes (Sqr/Cube), square roots (Sqrt), exponentials (Exp), three different logarithm bases (Ln, Log10, Log2), and the start of a full trig set (Sin). With 20 more packed in beyond that sample, you're clearly looking at the rest of a standard scientific-calculator function set - the remaining trig functions and the usual rounding helpers are the reasonable bet, though the brief doesn't enumerate every one, so scroll the actual dropdown in ComfyUI to see the full list rather than trusting a guess.
Practically: this is the node for the rare case where a simple two-input calculator node isn't enough - you need to bend one computed value through a curve (a square root for a smoother falloff, a log for compressing a wide range) rather than just add or multiply it against something else.
How it works
Pick an operation from op, feed a single value into a (NUMBER, default 0), get the transformed value back as NUMBER.
The inputs and outputs that matter
- op - the operation dropdown; this is the entire point of the node.
- a - the single NUMBER input being transformed.
- Output - NUMBER, chains into other ComfyMath NUMBER nodes, not directly into a plain FLOAT/INT socket elsewhere without a converter.
Installing it
Search ComfyMath in ComfyUI Manager, or:
cd ComfyUI/custom_nodes && git clone https://github.com/evanspearman/ComfyMath
then restart ComfyUI. No pip dependencies beyond ComfyUI's own, nothing to download.
Common issues
This is the least-visited node in the pack by search traffic, and honestly that tracks - most ComfyUI math needs are "combine two values," which FloatBinaryOperation/NumberBinaryOperation already cover, not "apply a trig or log function to one value." If you do need it, the obvious trap is domain errors: Sqrt or a log on a negative number, or dividing by zero inside whatever the hidden operations do internally, will error your run rather than quietly returning something usable. If your input is itself computed and could theoretically go negative or hit zero, that's worth a thought before you wire this in.
Remember this speaks ComfyMath's own NUMBER type, not a plain FLOAT - feed it via FloatToNumber/IntToNumber if your value is coming from elsewhere in a normal ComfyUI graph, and convert the output back with something like FloatToInt if the next node wants a native socket type instead of NUMBER.
Maintenance-wise, same story as the rest of ComfyMath: no active development since roughly early 2024 per community reports, but simple, dependency-free arithmetic that hasn't caused practical breakage as a result. Being the least-used node in an already quiet pack, it's also the one you're least likely to find someone else's troubleshooting thread about if you do hit something odd.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| op | COMBO | 32 options: Neg, Inc, Dec, Abs, Sqr, Cube, +26 | |
| a | NUMBER | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| NUMBER | NUMBER | — |