BigInteger.Log BigInteger.Log BigInteger.Log BigInteger.Log Method

Definição

Retorna o logaritmo de um número especificado.Returns the logarithm of a specified number.

Sobrecargas

Log(BigInteger) Log(BigInteger) Log(BigInteger) Log(BigInteger)

Retorna o logaritmo natural (de base e) de um número especificado.Returns the natural (base e) logarithm of a specified number.

Log(BigInteger, Double) Log(BigInteger, Double) Log(BigInteger, Double) Log(BigInteger, Double)

Retorna o logaritmo de um número especificado em uma base especificada.Returns the logarithm of a specified number in a specified base.

Log(BigInteger) Log(BigInteger) Log(BigInteger) Log(BigInteger)

Retorna o logaritmo natural (de base e) de um número especificado.Returns the natural (base e) logarithm of a specified number.

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

Parâmetros

value
BigInteger BigInteger BigInteger BigInteger

O número cujo logaritmo deve ser encontrado.The number whose logarithm is to be found.

Retornos

O logaritmo natural (base e) de value, conforme mostrado na tabela na seção Comentários.The natural (base e) logarithm of value, as shown in the table in the Remarks section.

Exceções

O log natural de value está fora do intervalo do tipo de dados Double.The natural log of value is out of range of the Double data type.

Comentários

O value parâmetro é especificado como um número de base 10.The value parameter is specified as a base 10 number.

O valor de retorno preciso desse método depende do sinal de value, como mostra a tabela a seguir.The precise return value of this method depends on the sign of value, as the following table shows.

Sinal de value parâmetroSign of value parameter Valor retornadoReturn value
PositivoPositive O logaritmo natural de value; ou seja, ln valueou log evalue.The natural logarithm of value; that is, ln value, or log evalue.
ZeroZero NegativeInfinity.NegativeInfinity.
NegativoNegative NaN.NaN.

Para calcular o logaritmo de base 10 de BigInteger um valor, chame Log10 o método.To calculate the base 10 logarithm of a BigInteger value, call the Log10 method. Para calcular o logaritmo de um número em outra base, chame o Log(BigInteger, Double) método.To calculate the logarithm of a number in another base, call the Log(BigInteger, Double) method.

Você pode encontrar a raiz quadrada de um número chamando o Log método junto com o Math.Exp método.You can find the square root of a number by calling the Log method along with the Math.Exp method. Observe que o resultado será Double.PositiveInfinity se o resultado for maior que Double.MaxValue.Note that the result is Double.PositiveInfinity if the result is greater than Double.MaxValue. O exemplo a seguir calcula a raiz quadrada de cada elemento em uma matriz BigInteger de valores.The following example calculates the square root of each element in an array of BigInteger values.

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

Esse método corresponde ao Math.Log(Double) método para os tipos numéricos primitivos.This method corresponds to the Math.Log(Double) method for the primitive numeric types.

Veja também

Log(BigInteger, Double) Log(BigInteger, Double) Log(BigInteger, Double) Log(BigInteger, Double)

Retorna o logaritmo de um número especificado em uma base especificada.Returns the logarithm of a specified number in a specified base.

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

Parâmetros

value
BigInteger BigInteger BigInteger BigInteger

Um número cujo logaritmo deve ser localizado.A number whose logarithm is to be found.

baseValue
Double Double Double Double

A base do logaritmo.The base of the logarithm.

Retornos

O logaritmo de base baseValue de value, conforme mostrado na tabela na seção Comentários.The base baseValue logarithm of value, as shown in the table in the Remarks section.

Exceções

O log de value está fora do intervalo do tipo de dados Double.The log of value is out of range of the Double data type.

Comentários

Os value parâmetros baseValue e são especificados como números de base 10.The value and baseValue parameters are specified as base 10 numbers.

O valor de retorno preciso do método depende do sinal de value e do sinal e do valor de baseValue, como mostra a tabela a seguir.The precise return value of the method depends on the sign of value and on the sign and value of baseValue, as the following table shows.

Parâmetro valuevalue parameter Parâmetro baseValuebaseValue parameter Valor retornadoReturn value
value > 0value > 0 (0 < baseValue < 1) -or-(baseValue > 1)(0 < baseValue < 1) -or-(baseValue > 1) logbaseValue(value)logbaseValue(value)
value < 0value < 0 (nenhum valor)(any value) Double.NaN
(nenhum valor)(any value) baseValue < 0baseValue < 0 Double.NaN
value != 1value != 1 baseValue = 0baseValue = 0 Double.NaN
value != 1value != 1 baseValue = Double.PositiveInfinity Double.NaN
(nenhum valor)(any value) baseValue = Double.NaN Double.NaN
(nenhum valor)(any value) baseValue = 1baseValue = 1 Double.NaN
value = 0value = 0 0 < baseValue < 10 < baseValue < 1 Double.PositiveInfinity
value = 0value = 0 baseValue > 1baseValue > 1 Double.PositiveInfinity
value = 1value = 1 baseValue = 0baseValue = 0 00
value = 1value = 1 baseValue = Double.PositiveInfinity 00

Para calcular o logaritmo de base 10 de BigInteger um valor, chame Log10 o método.To calculate the base 10 logarithm of a BigInteger value, call the Log10 method. Para calcular o logaritmo natural de um número, chame o Log(BigInteger) método.To calculate the natural logarithm of a number, call the Log(BigInteger) method.

Esse método corresponde ao Math.Log método para os tipos numéricos primitivos.This method corresponds to the Math.Log method for the primitive numeric types.

Veja também

Aplica-se a