BigInteger.Log Metoda

Definicja

Zwraca logarytm określonej liczby.

Przeciążenia

Nazwa Opis
Log(BigInteger)

Zwraca logarytm naturalny (podstawowy e) określonej liczby.

Log(BigInteger, Double)

Zwraca logarytm określonej liczby w określonej bazie.

Log(BigInteger)

Źródło:
BigInteger.cs
Źródło:
BigInteger.cs
Źródło:
BigInteger.cs
Źródło:
BigInteger.cs
Źródło:
BigInteger.cs

Zwraca logarytm naturalny (podstawowy e) określonej liczby.

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

Parametry

value
BigInteger

Liczba, której logarytm ma zostać znaleziony.

Zwraca

Logarytm enaturalny (podstawowy value) , jak pokazano w tabeli w sekcji Uwagi.

Wyjątki

Naturalny dziennik jest value poza zakresem Double typu danych.

Uwagi

Parametr value jest określany jako liczba podstawowa 10.

Dokładna wartość zwracana tej metody zależy od znaku value, jak pokazano w poniższej tabeli.

Znak parametru value Wartość zwracana
Dodatni Logarytm valuenaturalny , czyli ln value, lub log evalue.
Zero NegativeInfinity.
Ujemny NaN.

Aby obliczyć logarytm BigInteger podstawowy 10 wartości, wywołaj metodę Log10 . Aby obliczyć logarytm liczby w innej bazie, wywołaj metodę Log(BigInteger, Double) .

Pierwiastek kwadratowy liczby można znaleźć, wywołując metodę Log wraz z Math.Exp metodą . Zwróć uwagę, że wynik jest Double.PositiveInfinity większy niż Double.MaxValue. Poniższy przykład oblicza pierwiastek kwadratowy każdego elementu w tablicy BigInteger wartości.

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
open System
open System.Numerics

let values = [| 2I; 100I; BigInteger.Pow(1000I, 100); BigInteger.Pow(2I, 64) |]

for value in values do
    printfn $"The square root of {value} is {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

Ta metoda odpowiada metodzie Math.Log(Double) dla typów liczb pierwotnych.

Zobacz też

Dotyczy

Log(BigInteger, Double)

Źródło:
BigInteger.cs
Źródło:
BigInteger.cs
Źródło:
BigInteger.cs
Źródło:
BigInteger.cs
Źródło:
BigInteger.cs

Zwraca logarytm określonej liczby w określonej bazie.

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

Parametry

value
BigInteger

Liczba, której logarytm ma zostać znaleziony.

baseValue
Double

Podstawa logarytmu.

Zwraca

Logarytm baseValuepodstawowy value elementu , jak pokazano w tabeli w sekcji Uwagi.

Wyjątki

Dziennik elementu value jest poza zakresem Double typu danych.

Uwagi

Parametry value i baseValue są określane jako podstawowe 10 liczb.

Dokładna wartość zwracana metody zależy od znaku value i znaku i wartości baseValue, jak pokazano w poniższej tabeli.

value Parametr baseValue Parametr Wartość zwracana
value > 0 (0 <baseValue< 1) -or-(baseValue> 1) logbaseValue(value)
value < 0 (dowolna wartość) Double.NaN
(dowolna wartość) baseValue < 0 Double.NaN
value != 1 baseValue = 0 Double.NaN
value != 1 baseValue = Double.PositiveInfinity Double.NaN
(dowolna wartość) baseValue = Double.NaN Double.NaN
(dowolna wartość) 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

Aby obliczyć logarytm BigInteger podstawowy 10 wartości, wywołaj metodę Log10 . Aby obliczyć logarytm naturalny liczby, wywołaj metodę Log(BigInteger) .

Ta metoda odpowiada metodzie Math.Log dla typów liczb pierwotnych.

Zobacz też

Dotyczy