BigInteger.Log Método

Definición

Devuelve el logaritmo de un número especificado.

Sobrecargas

Log(BigInteger)

Devuelve el logaritmo natural (en base e) de un número especificado.

Log(BigInteger, Double)

Devuelve el logaritmo de un número especificado en una base determinada.

Log(BigInteger)

Source:
BigInteger.cs
Source:
BigInteger.cs
Source:
BigInteger.cs

Devuelve el logaritmo natural (en base e) de un número especificado.

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

Número cuyo logaritmo se va a calcular.

Devoluciones

Logaritmo natural (base e) de value, como se muestra en la tabla de la sección Comentarios.

Excepciones

El logaritmo natural de value está fuera del intervalo del tipo de datos Double.

Comentarios

El value parámetro se especifica como un número base 10.

El valor devuelto preciso de este método depende del signo de value, como se muestra en la tabla siguiente.

Signo del value parámetro Valor devuelto
Positivo Logaritmo natural de value; es decir, ln valueo log evalue.
Cero NegativeInfinity.
Negativo NaN.

Para calcular el logaritmo base 10 de un BigInteger valor, llame al Log10 método . Para calcular el logaritmo de un número en otra base, llame al Log(BigInteger, Double) método .

Puede encontrar la raíz cuadrada de un número llamando al Log método junto con el Math.Exp método . Tenga en cuenta que el resultado es Double.PositiveInfinity si el resultado es mayor que Double.MaxValue. En el ejemplo siguiente se calcula la raíz cuadrada de cada elemento de una matriz de BigInteger valores.

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

Este método corresponde al Math.Log(Double) método para los tipos numéricos primitivos.

Consulte también

Se aplica a

Log(BigInteger, Double)

Source:
BigInteger.cs
Source:
BigInteger.cs
Source:
BigInteger.cs

Devuelve el logaritmo de un número especificado en una base determinada.

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

Número cuyo logaritmo hay que calcular.

baseValue
Double

Base del logaritmo.

Devoluciones

Logaritmo en base baseValue de value, como se muestra en la tabla de la sección Comentarios.

Excepciones

El logaritmo de value está fuera del intervalo del tipo de datos Double.

Comentarios

Los value parámetros y baseValue se especifican como números base 10.

El valor devuelto preciso del método depende del signo de value y del signo y del valor de baseValue, como se muestra en la tabla siguiente.

Parámetro value Parámetro baseValue Valor devuelto
value> 0 (0 <baseValue< 1) o (baseValue> 1) logbaseValue(value)
value< 0 (cualquier valor) Double.NaN
(cualquier valor) baseValue< 0 Double.NaN
value != 1 baseValue = 0 Double.NaN
value != 1 baseValue = Double.PositiveInfinity Double.NaN
(cualquier valor) baseValue = Double.NaN Double.NaN
(cualquier valor) baseValue = 1 Double.NaN
value = 0 0 <baseValue< 1 Double.PositiveInfinity
value = 0 baseValue> 1 Double.PositiveInfinity
value = 1 baseValue = 0 0
value = 1 baseValue = Double.PositiveInfinity 0

Para calcular el logaritmo base 10 de un BigInteger valor, llame al Log10 método . Para calcular el logaritmo natural de un número, llame al Log(BigInteger) método .

Este método corresponde al Math.Log método para los tipos numéricos primitivos.

Consulte también

Se aplica a