What is Math.Log10() in C#?
C# has a built-in Math class that provides useful mathematical functions and operations. This class has the Log10() function, which is used to compute the base 10 logarithm of a specified number.
Syntax
public static double Log10 (double value);
Parameters
value: This is of theDoubletype and represents the input value for which we have to findLog10(). Its range is all double numbers.
Return value
-
Double: This returns a positiveDoublenumber representing the base 10 log of thevalue. -
NaN: This returns an input of negative orNaNinvalue. -
PositiveInfinity: This returns an input ofPositiveInfinityinvalue. -
NegativeInfinity: This returns an input of 0 invalue.
valueis a base 10 number.
Example
using System;class Educative{static void Main(){double result = Math.Log10(20);System.Console.WriteLine("Log10(20) = "+ result);double result1 = Math.Log10(-20);System.Console.WriteLine("Log10(-20) = "+ result1);double result2 = Math.Log10(0);System.Console.WriteLine("Log10(0) = "+ result2);double result3 = Math.Log10(Double.PositiveInfinity);System.Console.WriteLine("Log10(∞) = "+ result3);}}