Function log2 #

计算一个值的2的对数。这与计算 log(x, 2) 相同。

对于矩阵,该函数逐元素求值。

Syntax #

math.log2(x)

Parameters #

Parameter Type Description
x number | BigNumber | Complex | Array | Matrix 要计算对数的值。

Returns #

Type Description
number | BigNumber | Complex | Array | Matrix 返回 x 的2的对数

Throws #

Type | Description —- | ———–

Examples #

math.log2(0.03125)           // returns -5
math.log2(16)                // returns 4
math.log2(16) / math.log2(2) // returns 4
math.pow(2, 4)               // returns 16

另请参阅 #

exp, log, log1p, log10

Fork me on GitHub