log
Natural logarithms when your schedule is exponential under the hood
- value
- base
- FLOAT
log is the inverse of exp. Where exp builds exponential growth, log unwinds it - and in ComfyUI that usually means converting between perceptual and linear scales, or working out "what input produces this output" for a curve you've already got. The log node from Basic data handling computes the logarithm of a number with a base you choose, defaulting to e (the natural logarithm).
The real-world use case that shows up most: you have an exponential decay or growth curve in your workflow and you want to invert it - find the step where a value crosses a threshold, or linearize a perceptual scale before doing math on it. That's exactly what a logarithm is for.
How it works
The node is a wrapper around Python's math.log(value, base). The inputs:
value- the number you're taking the log of (FLOAT or INT, default1). The UI enforces a minimum of0.0000001.base- optional, default ise(so by default it's the natural log,ln). Set it to10for a base-10 log (the pack also has a dedicatedlog10node for that), or anything else you like.
Output is a single FLOAT.
A quick sanity chart so the outputs don't surprise you: log(1) is always 0 regardless of base; log(e) = 1 with the default base; log(100) = 2 with base 10. Values between 0 and 1 give negative logs, which is normal and often exactly what you want.
The domain warning
This is the one node in the pack that will throw an error at you if you feed it the wrong thing. The logarithm of zero or a negative number is undefined, and Python will raise a math domain error. The min on the input widget stops the typed case, but if you wire in a value that drifts to 0 or below at runtime, the node will fail with a traceback that mentions math domain error. If that happens, clamp the input first - floor it at some tiny epsilon - before it reaches the log node. That's the whole troubleshooting story for this one.
Installing it
Basic data handling is one of the rare no-dependency packs - no pip requirements, no model downloads, nothing to go stale. Install via ComfyUI Manager (search "Basic data handling"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart, and log sits under Basic/maths next to log10, exp, and sqrt.
Where you'd reach for it
Beyond the inverse-curve trick, logs show up in any workflow that works with decibels, perceptual scales, or "many orders of magnitude" value ranges - compressing a huge range into something a scheduler can digest. If your numbers span 0.001 to 1000 and your curve looks useless on a linear axis, a quick log (and exp on the way back out) is the standard answer.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT,INT | 1 | — |
| baseopt | FLOAT,INT | 2.718281828459045 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |