MathF.Log 方法

定义

重载

Log(Single, Single)

返回指定数字在使用指定底时的对数。Returns the logarithm of a specified number in a specified base.

Log(Single)

返回指定数字的自然对数(底为 e)。Returns the natural (base e) logarithm of a specified number.

Log(Single, Single)

返回指定数字在使用指定底时的对数。Returns the logarithm of a specified number in a specified base.

public:
 static float Log(float x, float y);
public static float Log (float x, float y);
static member Log : single * single -> single
Public Shared Function Log (x As Single, y As Single) As Single

参数

x
Single

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

y
Single

基数。The base.

返回

下表中的值之一。One of the values in the following table. (+Infinity 表示 PositiveInfinity,-Infinity 表示 NegativeInfinity,NaN 表示 NaN。)(+Infinity denotes PositiveInfinity, -Infinity denotes NegativeInfinity, and NaN denotes NaN.)

xnewBase 返回值Return value
x> 0x> 0 (0 <newBase< 1) 或 (newBase> 1)(0 <newBase< 1) -or-(newBase> 1) lognewBase(a)lognewBase(a)
x< 0x< 0 (任意值)(any value) NaNNaN
(任意值)(any value) newBase< 0newBase< 0 NaNNaN
x != 1x != 1 newBase = 0newBase = 0 NaNNaN
x != 1x != 1 newBase = +InfinitynewBase = +Infinity NaNNaN
x = NaNx = NaN (任意值)(any value) NaNNaN
(任意值)(any value) newBase = NaNnewBase = NaN NaNNaN
(任意值)(any value) newBase = 1newBase = 1 NaNNaN
x = 0x = 0 0 <newBase< 10 <newBase< 1 +Infinity+Infinity
x = 0x = 0 newBase> 1newBase> 1 -Infinity-Infinity
x = +Infinityx = +Infinity 0 <newBase< 10 <newBase< 1 -Infinity-Infinity
x = +Infinityx = +Infinity newBase> 1newBase> 1 +Infinity+Infinity
x = 1x = 1 newBase = 0newBase = 0 00
x = 1x = 1 newBase = +InfinitynewBase = +Infinity 00

Log(Single)

返回指定数字的自然对数(底为 e)。Returns the natural (base e) logarithm of a specified number.

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

参数

x
Single

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

返回

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

x 参数x parameter 返回值Return value
Positive x 的自然对数,即 ln x 或 log e xThe natural logarithm of x; that is, ln x, or log e x
Zero NegativeInfinity
负数Negative NaN
等于 NaNEqual to NaNNaN
等于 PositiveInfinityEqual to PositiveInfinityPositiveInfinity

注解

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

另请参阅

适用于