EN
C# / .NET - Math.Log10() method example
0 points
The Math.Log10()
method returns the logarithm with base 10 of a number.
xxxxxxxxxx
1
using System;
2
3
public class Program
4
{
5
public static void Main(string[] args)
6
{
7
// Logarithm with base 10:
8
// x y
9
Console.WriteLine( Math.Log10( 1 ) ); // 0
10
Console.WriteLine( Math.Log10( 3 ) ); // 0.47712125471966244
11
Console.WriteLine( Math.Log10( 10 ) ); // 1
12
Console.WriteLine( Math.Log10( 100 ) ); // 2
13
Console.WriteLine( Math.Log10( 1000 ) ); // 3
14
15
Console.WriteLine( Math.Log10( -1 ) ); // NaN
16
Console.WriteLine( Math.Log10( 0 ) ); // -∞ / -Infinity
17
Console.WriteLine( Math.Log10( Double.PositiveInfinity ) ); // ∞ / +Infinity
18
}
19
}
The Math.Log10()
method is presented on the following chart:

Syntax |
xxxxxxxxxx 1 namespace System 2 { 3 public static class Math 4 { 5 // ... 6 public static double Log10(double x) { ... } 7 // ... 8 } 9 } |
Parameters | x - double value in the range 0 to +Infinity (primitive value). |
Result |
If If If |
Description |
|