how to use ln in Java

后端 未结 2 908
一生所求
一生所求 2021-02-20 07:47

I\'m trying to use this formula in JAVA : (-ln(1-L))/L
I\'m not sure how to use ln in java.

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-20 08:24

    Math.log(d) returns the natural logarithm (base e) of a double value.

    So the java code will be,

    double result = (-Math.log(1-L))/L;
    

    (but note that it's better to have variable names in lower-case - i.e. l instead of L)

提交回复
热议问题