Skip to content

Exponentials and logarithms ​

FunctionSignatureDescription
exp(x: f64) => f64e^x
log(x: f64) => f64Natural logarithm
log10(x: f64) => f64Base-10 logarithm
log2(x: f64) => f64Base-2 logarithm
pow(base: f64, exp: f64) => f64Power

exp() ​

Returns Euler's number e raised to the power of x.

Signatureexp(x: f64): f64
tyrus
const value: f64 = 1.0;
const result: f64 = exp(value);
print(result); // ~2.7183 (e^1)

log() ​

Returns the natural logarithm (base e) of x.

Signaturelog(x: f64): f64
tyrus
const value: f64 = 2.7183;
const result: f64 = log(value);
print(result); // ~1.0 (ln(e))

log10() ​

Returns the base-10 logarithm of x.

Signaturelog10(x: f64): f64
tyrus
const value: f64 = 100.0;
const result: f64 = log10(value);
print(result); // 2.0

log2() ​

Returns the base-2 logarithm of x.

Signaturelog2(x: f64): f64
tyrus
const value: f64 = 8.0;
const result: f64 = log2(value);
print(result); // 3.0

pow() ​

Returns base raised to the power of exp.

Signaturepow(base: f64, exp: f64): f64
tyrus
const base: f64 = 2.0;
const exp: f64 = 3.0;
const result: f64 = pow(base, exp);
print(result); // 8.0