# BigInteger.Log 方法

## 重载

 Log(BigInteger) 返回指定数字的自然对数（底为 `e`）。Returns the natural (base `e`) logarithm of a specified number. Log(BigInteger, Double) 返回指定数字在使用指定底时的对数。Returns the logarithm of a specified number in a specified base.

## Log(BigInteger)

``````public:
static double Log(System::Numerics::BigInteger value);``````
``public static double Log (System.Numerics.BigInteger value);``
``static member Log : System.Numerics.BigInteger -> double``
``Public Shared Function Log (value As BigInteger) As Double``

value
BigInteger

#### 返回

Double

`value` 的自然对数（底为 `e`），如“备注”部分中的表所示。The natural (base `e`) logarithm of `value`, as shown in the table in the Remarks section.

#### 例外

`value` 的自然对数超出了 Double 数据类型的范围。The natural log of `value` is out of range of the Double data type.

### 注解

`value`参数被指定为以10为基数的数字。The `value` parameter is specified as a base 10 number.

Positive 的自然对数，即 `value` ln `value` 或 log e `value`The natural logarithm of `value`; that is, ln `value`, or log e`value`.
Zero

``````using System;
using System.Numerics;

public class Example
{
public static void Main()
{
BigInteger[] values = { 2, 100, BigInteger.Pow(1000, 100),
BigInteger.Pow(2, 64) };
foreach (var value in values)
Console.WriteLine("The square root of {0} is {1}", value,
Math.Exp(BigInteger.Log(value) / 2));
}
}
// The example displays the following output:
//    The square root of 2 is 1.41421356237309
//    The square root of 100 is 10
//    The square root of 1000000000000000000000000000000000000000000000000000000000000
//    00000000000000000000000000000000000000000000000000000000000000000000000000000000
//    00000000000000000000000000000000000000000000000000000000000000000000000000000000
//    00000000000000000000000000000000000000000000000000000000000000000000000000000000
//     is 9.99999999999988E+149
//    The square root of 18446744073709551616 is 4294967296
``````
``````Imports System.Numerics

Module Example
Public Sub Main()
Dim values() As BigInteger = { 2, 100, BigInteger.Pow(1000, 100),
BigInteger.Pow(2, 64) }
For Each value In values
Console.WriteLine("The square root of {0} is {1}", value,
Math.Exp(BigInteger.Log(value) / 2))
Next
End Sub
End Module
' The example displays the following output:
'    The square root of 2 is 1.41421356237309
'    The square root of 100 is 10
'    The square root of 1000000000000000000000000000000000000000000000000000000000000
'    00000000000000000000000000000000000000000000000000000000000000000000000000000000
'    00000000000000000000000000000000000000000000000000000000000000000000000000000000
'    00000000000000000000000000000000000000000000000000000000000000000000000000000000
'     is 9.99999999999988E+149
'    The square root of 18446744073709551616 is 4294967296
``````

## Log(BigInteger, Double)

``````public:
static double Log(System::Numerics::BigInteger value, double baseValue);``````
``public static double Log (System.Numerics.BigInteger value, double baseValue);``
``static member Log : System.Numerics.BigInteger * double -> double``
``Public Shared Function Log (value As BigInteger, baseValue As Double) As Double``

value
BigInteger

baseValue
Double

#### 返回

Double

`baseValue` 的以 `value` 为底的对数，如“备注”部分中的表所示。The base `baseValue` logarithm of `value`, as shown in the table in the Remarks section.

#### 例外

`value` 的对数超出了 Double 数据类型的范围。The log of `value` is out of range of the Double data type.

### 注解

`value``baseValue` 参数指定为以10为基数的数字。The `value` and `baseValue` parameters are specified as base 10 numbers.

`value` 参数`value` parameter `baseValue` 参数`baseValue` parameter 返回值Return value
`value` > 0`value` > 0 (0 < `baseValue` < 1) -或- (> `baseValue` 1) (0 < `baseValue` < 1) -or-(`baseValue` > 1) logbaseValue (`value`) logbaseValue(`value`)
`value` < 0`value` < 0 （任意值）(any value) Double.NaN
（任意值）(any value) `baseValue` < 0`baseValue` < 0 Double.NaN
`value` != 1`value` != 1 `baseValue` = 0`baseValue` = 0 Double.NaN
`value` != 1`value` != 1 `baseValue` = Double.PositiveInfinity Double.NaN
（任意值）(any value) `baseValue` = Double.NaN Double.NaN
（任意值）(any value) `baseValue` = 1`baseValue` = 1 Double.NaN
`value` = 0`value` = 0 0 < `baseValue` < 10 < `baseValue` < 1 Double.PositiveInfinity
`value` = 0`value` = 0 `baseValue` > 1`baseValue` > 1 Double.PositiveInfinity
`value` = 1`value` = 1 `baseValue` = 0`baseValue` = 0 00
`value` = 1`value` = 1 `baseValue` = Double.PositiveInfinity 00