Freigeben über


Math.Log10-Methode

Gibt den Logarithmus einer angegebenen Zahl zur Basis 10 zurück.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared Function Log10 ( _
    d As Double _
) As Double
'Usage
Dim d As Double
Dim returnValue As Double

returnValue = Math.Log10(d)
public static double Log10 (
    double d
)
public:
static double Log10 (
    double d
)
public static double Log10 (
    double d
)
public static function Log10 (
    d : double
) : double

Parameter

  • d
    Eine Zahl, deren Logarithmus gesucht wird.

Rückgabewert

Vorzeichen von d

Rückgabe

Positiv

Der Logarithmus von d zur Basis 10, d. h. log10d.

0 (null)

NegativeInfinity

Negativ

NaN

Wenn d gleich NaN ist, wird NaN zurückgegeben. Wenn d gleich PositiveInfinity ist, wird PositiveInfinity zurückgegeben.

Hinweise

Der d-Parameter wird als Zahl zur Basis 10 angegeben.

Beispiel

Im folgenden Beispiel werden mit Log10 bestimmte logarithmische Identitäten für ausgewählte Werte ausgewertet.

' Example for the Math.Log( Double, Double )and Math.Log10( Double ) methods.
Imports System
Imports Microsoft.VisualBasic

Module LogDDLog10
       
    Sub Main()
        Console.WriteLine( _
            "This example of Math.Log( Double, Double ) " + _
            "and Math.Log10( Double )" & vbCrLf & _
            "generates the following output." & vbCrLf)
        Console.WriteLine( _
            "Evaluate these identities with " & _
            "selected values for X and B (base):")
        Console.WriteLine("   log(B)[X] = 1 / log(X)[B]")
        Console.WriteLine("   log(B)[X] = log(10)[X] / log(10)[B]")
        Console.WriteLine("   log(B)[X] = log(B)[10] * log(10)[X]")
          
        UseBaseAndArg(0.1, 1.2)
        UseBaseAndArg(1.2, 4.9)
        UseBaseAndArg(4.9, 9.9)
        UseBaseAndArg(9.9, 0.1)
    End Sub 'Main
       
    ' Evaluate logarithmic identities that are functions of two arguments.
    Sub UseBaseAndArg(argB As Double, argX As Double)

        ' Evaluate log(B)[X] = 1 / log(X)[B].
        Console.WriteLine( _
            vbCrLf & "                   Math.Log({1}, {0}) = {2:E16}" + _
            vbCrLf & "             1.0 / Math.Log({0}, {1}) = {3:E16}", _
            argB, argX, Math.Log(argX, argB), _
            1.0 / Math.Log(argB, argX))
          
        ' Evaluate log(B)[X] = log(10)[X] / log(10)[B].
        Console.WriteLine( _
            "    Math.Log10({1}) / Math.Log10({0}) = {2:E16}", _
            argB, argX, Math.Log10(argX) / Math.Log10(argB))
          
        ' Evaluate log(B)[X] = log(B)[10] * log(10)[X].
        Console.WriteLine( _
            "Math.Log(10.0, {0}) * Math.Log10({1}) = {2:E16}", _
            argB, argX, Math.Log(10.0, argB) * Math.Log10(argX))

    End Sub 'UseBaseAndArg
End Module 'LogDDLog10

' This example of Math.Log( Double, Double ) and Math.Log10( Double )
' generates the following output.
'
' Evaluate these identities with selected values for X and B (base):
'    log(B)[X] = 1 / log(X)[B]
'    log(B)[X] = log(10)[X] / log(10)[B]
'    log(B)[X] = log(B)[10] * log(10)[X]
' 
'                    Math.Log(1.2, 0.1) = -7.9181246047624818E-002
'              1.0 / Math.Log(0.1, 1.2) = -7.9181246047624818E-002
'     Math.Log10(1.2) / Math.Log10(0.1) = -7.9181246047624818E-002
' Math.Log(10.0, 0.1) * Math.Log10(1.2) = -7.9181246047624831E-002
' 
'                    Math.Log(4.9, 1.2) = 8.7166610085093179E+000
'              1.0 / Math.Log(1.2, 4.9) = 8.7166610085093161E+000
'     Math.Log10(4.9) / Math.Log10(1.2) = 8.7166610085093179E+000
' Math.Log(10.0, 1.2) * Math.Log10(4.9) = 8.7166610085093179E+000
' 
'                    Math.Log(9.9, 4.9) = 1.4425396251981288E+000
'              1.0 / Math.Log(4.9, 9.9) = 1.4425396251981288E+000
'     Math.Log10(9.9) / Math.Log10(4.9) = 1.4425396251981288E+000
' Math.Log(10.0, 4.9) * Math.Log10(9.9) = 1.4425396251981291E+000
' 
'                    Math.Log(0.1, 9.9) = -1.0043839404494075E+000
'              1.0 / Math.Log(9.9, 0.1) = -1.0043839404494075E+000
'     Math.Log10(0.1) / Math.Log10(9.9) = -1.0043839404494077E+000
' Math.Log(10.0, 9.9) * Math.Log10(0.1) = -1.0043839404494077E+000
// Example for the Math.Log( double, double ) and Math.Log10( double ) methods.
using System;

class LogDDLog10 
{
    public static void Main() 
    {
        Console.WriteLine( 
            "This example of Math.Log( double, double ) " +
            "and Math.Log10( double )\n" +
            "generates the following output.\n" );
        Console.WriteLine( 
            "Evaluate these identities with " +
            "selected values for X and B (base):" );
        Console.WriteLine( "   log(B)[X] == 1 / log(X)[B]" );
        Console.WriteLine( "   log(B)[X] == log(10)[X] / log(10)[B]" );
        Console.WriteLine( "   log(B)[X] == log(B)[10] * log(10)[X]" );

        UseBaseAndArg(0.1, 1.2);
        UseBaseAndArg(1.2, 4.9);
        UseBaseAndArg(4.9, 9.9);
        UseBaseAndArg(9.9, 0.1);
    }

    // Evaluate logarithmic identities that are functions of two arguments.
    static void UseBaseAndArg(double argB, double argX)
    {
        // Evaluate log(B)[X] == 1 / log(X)[B].
        Console.WriteLine( 
            "\n                   Math.Log({1}, {0}) == {2:E16}" + 
            "\n             1.0 / Math.Log({0}, {1}) == {3:E16}", 
            argB, argX, Math.Log(argX, argB),
            1.0 / Math.Log(argB, argX) );

        // Evaluate log(B)[X] == log(10)[X] / log(10)[B].
        Console.WriteLine( 
            "    Math.Log10({1}) / Math.Log10({0}) == {2:E16}",
            argB, argX, Math.Log10(argX) / Math.Log10(argB) );

        // Evaluate log(B)[X] == log(B)[10] * log(10)[X].
        Console.WriteLine( 
            "Math.Log(10.0, {0}) * Math.Log10({1}) == {2:E16}", 
            argB, argX, Math.Log(10.0, argB) * Math.Log10(argX) );
    }
}

/*
This example of Math.Log( double, double ) and Math.Log10( double )
generates the following output.

Evaluate these identities with selected values for X and B (base):
   log(B)[X] == 1 / log(X)[B]
   log(B)[X] == log(10)[X] / log(10)[B]
   log(B)[X] == log(B)[10] * log(10)[X]

                   Math.Log(1.2, 0.1) == -7.9181246047624818E-002
             1.0 / Math.Log(0.1, 1.2) == -7.9181246047624818E-002
    Math.Log10(1.2) / Math.Log10(0.1) == -7.9181246047624818E-002
Math.Log(10.0, 0.1) * Math.Log10(1.2) == -7.9181246047624831E-002

                   Math.Log(4.9, 1.2) == 8.7166610085093179E+000
             1.0 / Math.Log(1.2, 4.9) == 8.7166610085093161E+000
    Math.Log10(4.9) / Math.Log10(1.2) == 8.7166610085093179E+000
Math.Log(10.0, 1.2) * Math.Log10(4.9) == 8.7166610085093179E+000

                   Math.Log(9.9, 4.9) == 1.4425396251981288E+000
             1.0 / Math.Log(4.9, 9.9) == 1.4425396251981288E+000
    Math.Log10(9.9) / Math.Log10(4.9) == 1.4425396251981288E+000
Math.Log(10.0, 4.9) * Math.Log10(9.9) == 1.4425396251981291E+000

                   Math.Log(0.1, 9.9) == -1.0043839404494075E+000
             1.0 / Math.Log(9.9, 0.1) == -1.0043839404494075E+000
    Math.Log10(0.1) / Math.Log10(9.9) == -1.0043839404494077E+000
Math.Log(10.0, 9.9) * Math.Log10(0.1) == -1.0043839404494077E+000
*/
// Example for the Math::Log( double, double ) and Math::Log10( double ) methods.
using namespace System;

// Evaluate logarithmic identities that are functions of two arguments.
void UseBaseAndArg( double argB, double argX )
{
   
   // Evaluate log(B)[X] == 1 / log(X)[B].
   Console::WriteLine( "\n                    Math::Log({1}, {0}) == {2:E16}"
   "\n              1.0 / Math::Log({0}, {1}) == {3:E16}", argB, argX, Math::Log( argX, argB ), 1.0 / Math::Log( argB, argX ) );
   
   // Evaluate log(B)[X] == log(10)[X] / log(10)[B].
   Console::WriteLine( "    Math::Log10({1}) / Math::Log10({0}) == {2:E16}", argB, argX, Math::Log10( argX ) / Math::Log10( argB ) );
   
   // Evaluate log(B)[X] == log(B)[10] * log(10)[X].
   Console::WriteLine( "Math::Log(10.0, {0}) * Math::Log10({1}) == {2:E16}", argB, argX, Math::Log( 10.0, argB ) * Math::Log10( argX ) );
}

int main()
{
   Console::WriteLine( "This example of Math::Log( double, double ) "
   "and Math::Log10( double )\n"
   "generates the following output.\n" );
   Console::WriteLine( "Evaluate these identities with "
   "selected values for X and B (base):" );
   Console::WriteLine( "   log(B)[X] == 1 / log(X)[B]" );
   Console::WriteLine( "   log(B)[X] == log(10)[X] / log(10)[B]" );
   Console::WriteLine( "   log(B)[X] == log(B)[10] * log(10)[X]" );
   UseBaseAndArg( 0.1, 1.2 );
   UseBaseAndArg( 1.2, 4.9 );
   UseBaseAndArg( 4.9, 9.9 );
   UseBaseAndArg( 9.9, 0.1 );
}

/*
This example of Math::Log( double, double ) and Math::Log10( double )
generates the following output.

Evaluate these identities with selected values for X and B (base):
   log(B)[X] == 1 / log(X)[B]
   log(B)[X] == log(10)[X] / log(10)[B]
   log(B)[X] == log(B)[10] * log(10)[X]

                    Math::Log(1.2, 0.1) == -7.9181246047624818E-002
              1.0 / Math::Log(0.1, 1.2) == -7.9181246047624818E-002
    Math::Log10(1.2) / Math::Log10(0.1) == -7.9181246047624818E-002
Math::Log(10.0, 0.1) * Math::Log10(1.2) == -7.9181246047624831E-002

                    Math::Log(4.9, 1.2) == 8.7166610085093179E+000
              1.0 / Math::Log(1.2, 4.9) == 8.7166610085093161E+000
    Math::Log10(4.9) / Math::Log10(1.2) == 8.7166610085093179E+000
Math::Log(10.0, 1.2) * Math::Log10(4.9) == 8.7166610085093179E+000

                    Math::Log(9.9, 4.9) == 1.4425396251981288E+000
              1.0 / Math::Log(4.9, 9.9) == 1.4425396251981288E+000
    Math::Log10(9.9) / Math::Log10(4.9) == 1.4425396251981288E+000
Math::Log(10.0, 4.9) * Math::Log10(9.9) == 1.4425396251981291E+000

                    Math::Log(0.1, 9.9) == -1.0043839404494075E+000
              1.0 / Math::Log(9.9, 0.1) == -1.0043839404494075E+000
    Math::Log10(0.1) / Math::Log10(9.9) == -1.0043839404494077E+000
Math::Log(10.0, 9.9) * Math::Log10(0.1) == -1.0043839404494077E+000
*/
// Example for the Math.Log( double, double ) and Math.Log10( double ) methods.
import System.*;

class LogDDLog10
{
    public static void main(String[] args)
    {
        Console.WriteLine(("This example of Math.Log( double, double ) " 
            + "and Math.Log10( double )\n" 
            + "generates the following output.\n"));
        Console.WriteLine(("Evaluate these identities with " 
            + "selected values for X and B (base):"));
        Console.WriteLine("   log(B)[X] == 1 / log(X)[B]");
        Console.WriteLine("   log(B)[X] == log(10)[X] / log(10)[B]");
        Console.WriteLine("   log(B)[X] == log(B)[10] * log(10)[X]");
        UseBaseAndArg(0.1, 1.2);
        UseBaseAndArg(1.2, 4.9);
        UseBaseAndArg(4.9, 9.9);
        UseBaseAndArg(9.9, 0.1);
    } //main
     
    // Evaluate logarithmic identities that are functions of two arguments.
    static void UseBaseAndArg(double argB, double argX)
    {
        // Evaluate log(B)[X] == 1 / log(X)[B].
        Console.WriteLine("\n                   Math.Log({1}, {0}) == {2}" 
            + "\n             1.0 / Math.Log({0}, {1}) == {3}",
            new Object[]{ System.Convert.ToString(argB), 
            System.Convert.ToString(argX),((System.Double)( 
            System.Math.Log(argX, argB))).ToString("E16"), 
            ((System.Double)(1.0 / System.Math.Log(argB, argX)))
            .ToString("E16")});

        // Evaluate log(B)[X] == log(10)[X] / log(10)[B].
        Console.WriteLine("    Math.Log10({1}) / Math.Log10({0}) == {2}", 
            System.Convert.ToString(argB), 
            System.Convert.ToString(argX), 
            ((System.Double)(System.Math.Log10(argX) / 
            System.Math.Log10(argB))).ToString("E16"));

        // Evaluate log(B)[X] == log(B)[10] * log(10)[X].
        Console.WriteLine("Math.Log(10.0, {0}) * Math.Log10({1}) == {2}", 
            System.Convert.ToString(argB), 
            System.Convert.ToString(argX),
            ((System.Double) (System.Math.Log(10.0, argB)
            * System.Math.Log10(argX))).ToString("E16") );
    } //UseBaseAndArg
} //LogDDLog10

/*
This example of Math.Log( double, double ) and Math.Log10( double )
generates the following output.

Evaluate these identities with selected values for X and B (base):
   log(B)[X] == 1 / log(X)[B]
   log(B)[X] == log(10)[X] / log(10)[B]
   log(B)[X] == log(B)[10] * log(10)[X]

                   Math.Log(1.2, 0.1) == -7.9181246047624818E-002
             1.0 / Math.Log(0.1, 1.2) == -7.9181246047624818E-002
    Math.Log10(1.2) / Math.Log10(0.1) == -7.9181246047624818E-002
Math.Log(10.0, 0.1) * Math.Log10(1.2) == -7.9181246047624831E-002

                   Math.Log(4.9, 1.2) == 8.7166610085093179E+000
             1.0 / Math.Log(1.2, 4.9) == 8.7166610085093161E+000
    Math.Log10(4.9) / Math.Log10(1.2) == 8.7166610085093179E+000
Math.Log(10.0, 1.2) * Math.Log10(4.9) == 8.7166610085093179E+000

                   Math.Log(9.9, 4.9) == 1.4425396251981288E+000
             1.0 / Math.Log(4.9, 9.9) == 1.4425396251981288E+000
    Math.Log10(9.9) / Math.Log10(4.9) == 1.4425396251981288E+000
Math.Log(10.0, 4.9) * Math.Log10(9.9) == 1.4425396251981291E+000

                   Math.Log(0.1, 9.9) == -1.0043839404494075E+000
             1.0 / Math.Log(9.9, 0.1) == -1.0043839404494075E+000
    Math.Log10(0.1) / Math.Log10(9.9) == -1.0043839404494077E+000
Math.Log(10.0, 9.9) * Math.Log10(0.1) == -1.0043839404494077E+000
*/

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

Math-Klasse
Math-Member
System-Namespace