log
Function
log — natural logarithm
Synopsis
log(val: number) -> float64
Description
The log function returns the natural logarithm of its argument val
, which
must be numeric. The return value is a float64 or an error.
Examples
The logarithm of various numbers:
echo '4 4.0 2.718 -1' | zq -z 'yield log(this)' -
=>
1.3862943611198906
1.3862943611198906
0.999896315728952
error("log: illegal argument: -1")
The largest power of 10 smaller than the input:
echo '9 10 20 1000 1100 30000' | zq -z 'yield int64(log(this)/log(10))' -
=>
0
1
1
2
3
4