go Logb()

Logb()方法语法

func Logb(x float64) float64

go源码对Logb()方法的介绍:

Logb returns the binary exponent of x.

Special cases are:

Logb(±Inf) = +Inf
Logb(0) = -Inf
Logb(NaN) = NaN

golang math.Logb()方法,可用于返回float64类型参数x的二进制指数值,类似于Trunc(Log2(x)),除此之外,Logb(±Inf) = +Inf;Logb(0) = -Inf;Logb(NaN) = NaN。


math.Logb()方法实例代码

func main() {
	var logb_v float64 = math.Logb(5)
	fmt.Println(logb_v)
}

运行go文件,得到输出:

2

全栈后端 / go语法 :













Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.