BigInteger.Log Methode
Definition
Gibt den Logarithmus der angegebenen Zahl zurück.Returns the logarithm of a specified number.
Überlädt
Log(BigInteger) |
Gibt den natürlichen Logarithmus (zur Basis |
Log(BigInteger, Double) |
Gibt den Logarithmus einer angegebenen Zahl bezüglich einer angegebenen Basis zurück.Returns the logarithm of a specified number in a specified base. |
Log(BigInteger)
Gibt den natürlichen Logarithmus (zur Basis e
) der angegebenen Zahl zurück.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
Parameter
- value
- BigInteger
Die Zahl, deren Logarithmus bestimmt werden soll.The number whose logarithm is to be found.
Gibt zurück
Der natürliche Logarithmus (Basis e
) von value
, wie in der Tabelle im Abschnitt "Hinweise" veranschaulicht.The natural (base e
) logarithm of value
, as shown in the table in the Remarks section.
Ausnahmen
Der natürliche Logarithmus von value
liegt außerhalb des Bereichs des Double-Datentyps.The natural log of value
is out of range of the Double data type.
Hinweise
Der- value
Parameter wird als Basis 10 angegeben.The value
parameter is specified as a base 10 number.
Der genaue Rückgabewert dieser Methode hängt vom Vorzeichen von ab value
, wie in der folgenden Tabelle gezeigt.The precise return value of this method depends on the sign of value
, as the following table shows.
Vorzeichen des value ParametersSign of value parameter |
RückgabewertReturn value |
---|---|
PositivPositive | Der natürliche Logarithmus von value , d value . h. ln oder Log e value .The natural logarithm of value ; that is, ln value , or log evalue . |
ZeroZero | NegativeInfinity.NegativeInfinity. |
NegativNegative | NaN.NaN. |
Um den Logarithmus zur Basis 10 eines Werts zu berechnen, müssen Sie BigInteger die-Methode aufzurufen Log10 .To calculate the base 10 logarithm of a BigInteger value, call the Log10 method. Um den Logarithmus einer Zahl in einer anderen Basis zu berechnen, wird die- Log(BigInteger, Double) Methode aufgerufen.To calculate the logarithm of a number in another base, call the Log(BigInteger, Double) method.
Sie können die Quadratwurzel einer Zahl ermitteln, indem Sie die- Log Methode zusammen mit der- Math.Exp Methode aufrufen.You can find the square root of a number by calling the Log method along with the Math.Exp method. Beachten Sie, dass das Ergebnis ist, Double.PositiveInfinity Wenn das Ergebnis größer als ist Double.MaxValue .Note that the result is Double.PositiveInfinity if the result is greater than Double.MaxValue. Im folgenden Beispiel wird die Quadratwurzel der einzelnen Elemente in einem Array von- BigInteger Werten berechnet.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
Diese Methode entspricht der- Math.Log(Double) Methode für die primitiven numerischen Typen.This method corresponds to the Math.Log(Double) method for the primitive numeric types.
Siehe auch
Gilt für:
Log(BigInteger, Double)
Gibt den Logarithmus einer angegebenen Zahl bezüglich einer angegebenen Basis zurück.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
Parameter
- value
- BigInteger
Eine Zahl, deren Logarithmus gesucht wird.A number whose logarithm is to be found.
- baseValue
- Double
Die Basis des Logarithmus.The base of the logarithm.
Gibt zurück
Der Logarithmus zur Basis baseValue
von value
, wie in der Tabelle im Abschnitt "Hinweise" veranschaulicht.The base baseValue
logarithm of value
, as shown in the table in the Remarks section.
Ausnahmen
Das Protokoll von value
liegt außerhalb des Bereichs des Double-Datentyps.The log of value
is out of range of the Double data type.
Hinweise
Der value
-Parameter und der- baseValue
Parameter werden als Basis 10 Zahlen angegeben.The value
and baseValue
parameters are specified as base 10 numbers.
Der genaue Rückgabewert der-Methode hängt vom Vorzeichen von value
und vom-Zeichen und-Wert von ab baseValue
, wie in der folgenden Tabelle gezeigt.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.
value -Parametervalue parameter |
baseValue -ParameterbaseValue parameter |
RückgabewertReturn value |
---|---|---|
value > 0value > 0 |
(0 < baseValue < 1)-oder-( baseValue > 1)(0 < baseValue < 1) -or-(baseValue > 1) |
logbasevalue ( value )logbaseValue(value ) |
value < 0value < 0 |
(beliebiger Wert)(any value) | Double.NaN |
(beliebiger Wert)(any value) | baseValue < 0baseValue < 0 |
Double.NaN |
value != 1value != 1 |
baseValue = 0baseValue = 0 |
Double.NaN |
value != 1value != 1 |
baseValue = Double.PositiveInfinity |
Double.NaN |
(beliebiger Wert)(any value) | baseValue = Double.NaN |
Double.NaN |
(beliebiger Wert)(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 |
Um den Logarithmus zur Basis 10 eines Werts zu berechnen, müssen Sie BigInteger die-Methode aufzurufen Log10 .To calculate the base 10 logarithm of a BigInteger value, call the Log10 method. Um den natürlichen Logarithmus einer Zahl zu berechnen, wird die- Log(BigInteger) Methode aufgerufen.To calculate the natural logarithm of a number, call the Log(BigInteger) method.
Diese Methode entspricht der- Math.Log Methode für die primitiven numerischen Typen.This method corresponds to the Math.Log method for the primitive numeric types.