MathF.Log2(Single) 方法

定义

返回指定数字以 2 为底的对数。Returns the base 2 logarithm of a specified number.

public:
 static float Log2(float x);
public static float Log2 (float x);
static member Log2 : single -> single
Public Shared Function Log2 (x As Single) As Single

参数

x
Single

要查找其对数的数字。A number whose logarithm is to be found.

返回

Single

下表中的值之一。One of the values in the following table.

x 参数x parameter 返回值Return value
Positive x 以 2 为底的对数,即 log 2xThe base 2 log of x; that is, log 2x.
Zero NegativeInfinity
负数Negative NaN
等于 NaNEqual to NaNNaN
等于 PositiveInfinityEqual to PositiveInfinityPositiveInfinity

注解

参数 x 被指定为以10为基数的数字。Parameter x is specified as a base 10 number.

此方法调入基础 C 运行时,并且不同的操作系统或体系结构的确切结果或有效输入范围可能不同。This method calls into the underlying C runtime, and the exact result or valid input range may differ between different operating systems or architectures.

适用于