Skip to content

Logarithmic Operation

Performs logarithmic and exponential calculations on a single numeric value. Supports custom-base logarithm, natural log, base-10, base-2 logs, and exponential functions with base e or 2. Inputs are validated to avoid invalid domains (e.g., non-positive values for logs), returning 0.0 when invalid.
Preview

Usage

Use this node whenever you need logarithmic transformations or exponential growth calculations in a workflow. Typical use cases include scaling values, converting between orders of magnitude, computing natural or base-specific logs, or generating exponential outputs for further math or control logic. Choose the operation and set the value (and base when using custom log).

Inputs

FieldRequiredTypeDescriptionExample
valueTrueFLOATThe numeric input to operate on. Must be > 0 for log operations; can be any float for exp operations.8.0
baseTrueFLOATBase for the custom logarithm when operation is 'log'. Must be > 0 and not equal to 1. Ignored for ln, log10, log2, exp, and exp2.2.0
operationTrueSTRINGSelect the operation: 'log' (custom base), 'ln' (natural log), 'log10', 'log2', 'exp' (e^value), or 'exp2' (2^value).log2

Outputs

FieldTypeDescriptionExample
resultFLOATThe computed result of the selected logarithmic or exponential operation.3.0

Important Notes

  • Input domains: For 'log' the value must be > 0, base > 0, and base != 1. For 'ln', 'log10', and 'log2', the value must be > 0.
  • Ignored base: The 'base' input is only used for the 'log' operation; it is ignored for all other operations.
  • Out-of-range handling: Invalid inputs or math errors return 0.0. Extremely large exponents may overflow and likewise return 0.0.
  • Precision: Results are floating-point and subject to standard floating-point precision behavior.
  • Defaults and ranges: UI constraints typically enforce value/base within [0.001, 1e10]; adjust upstream if smaller or negative values are needed for non-log operations.

Troubleshooting

  • Result is 0.0 for logs: Ensure 'value' > 0; for 'log', also ensure 'base' > 0 and 'base' != 1.
  • Unexpected 0.0 for exp: The input may be too large causing overflow. Reduce 'value' or normalize your input before applying 'exp'/'exp2'.
  • Base seems to have no effect: The 'base' parameter only affects the 'log' operation. For ln/log10/log2, it is intentionally ignored.
  • Precision discrepancies: Small differences can occur due to floating-point arithmetic. If needed, round downstream using a rounding node.