h

    holgerbrandl

    4 years ago
    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
    gildor

    gildor

    4 years ago
    localhost? 😀
    h

    holgerbrandl

    4 years ago
    ups sorry, fixed!
    gaetan

    gaetan

    4 years ago
    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.
    gildor

    gildor

    4 years ago
    But what if implementation just check base and use intrinsics for standard bases?
    gaetan

    gaetan

    4 years ago
    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.
    elizarov

    elizarov

    4 years ago
    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.
    A function called
    log
    that can only be invoked with two doubles is less prone to this kind of confusion.
    h

    holgerbrandl

    4 years ago
    sure, logging how could we miss that. Thanks for pointing that out.
    gaetan

    gaetan

    4 years ago
    Ok, then the documentation of
    log(x,x)
    should be more explicit, indicating
    ln
    ,
    log10
    ,
    log2
    .
    elizarov

    elizarov

    4 years ago
    Agree