Log (Function) — Skript

Addon: Skript · Category: Function

Syntax

log(n: number, [base: number]) :: number

Description

A logarithm, with base 10 if none is specified. This is the inverse operation to exponentiation (for positive bases only), i.e. <code>log(base ^ exponent, base) = exponent</code> for any positive number 'base' and any number 'exponent'. Another useful equation is <code>base ^ log(a, base) = a</code> for any numbers 'base' and 'a'. Please note that due to how numbers are represented in computers, these equations do not hold for all numbers, as the computed values may slightly differ from the correct value. Returns NaN (not a number) if any of the arguments are negative.

Examples

log(100) = 2 # 10^2 = 100
log(16, 2) = 4 # 2^4 = 16

View source