go Log1p()
Log1p()方法语法
func Log1p(x float64) float64
go源码对Log1p()方法的介绍:
Log1p returns the natural logarithm of 1 plus its argument x. It is more accurate than Log(1 + x) when x is near zero.
Special cases are:
Log1p(+Inf) = +Inf
Log1p(±0) = ±0
Log1p(-1) = -Inf
Log1p(x < -1) = NaN
golang模块math.Log1p()方法,所求的自然对数值类似于Log(1+x),但是在求参数x接近0的情况之时,Log1p()方法更加精确。除此之外,Log1p(+Inf) = +Inf;Log1p(±0) = ±0;Log1p(-1) = -Inf;Log1p(x < -1) = NaN;Log1p(NaN) = NaN。
math.Log1p()方法实例代码
func main() {
log1p_v := math.Log1p(0.1)
fmt.Println(log1p_v)
}
运行go文件,得到输出:
0.09531017980432487