Indeed <@U0C1JH0RF>. Does kotlin-`log` at least pr...
# stdlib
h
Indeed @gaetan. Does kotlin-
log
at least provide
e
as default for the base? Because if so users could keep using
log
as natural logarithm. LIke in python https://docs.python.org/2/library/math.html#math.log or R http://astrostatistics.psu.edu/su07/R/html/base/html/Log.html
g
localhost? 😀
h
ups sorry, fixed!
g
I think there is a performance point.
ln
,
log10
and
log2
implementations directly delegated calls to native implementations which is not the case for
log
. 99,9% of use should have the best performance.
g
But what if implementation just check base and use intrinsics for standard bases?
g
Could be. After it should be clearly explained. I was porting some code using kotlin.js.Math and didn’t understand at first that kotlin.js.Math.log was replaced by kotlin.math.ln. And again,
ln
is not the convention on java and javascript.
e
This is an interesting idea. However, we are adding math function on the top level, which forces us to consider a different set of tradeoffs.
In particular, if we were to support one-arg
log(x)
function for a natural logarithm, then it is highly likely that it is going to conflict with logging functions in many real-life projects.
👍 2
A function called
log
that can only be invoked with two doubles is less prone to this kind of confusion.
h
sure, logging how could we miss that. Thanks for pointing that out.
g
Ok, then the documentation of
log(x,x)
should be more explicit, indicating
ln
,
log10
,
log2
.
e
Agree