Double - Log10
Returns the base 10 logarithm of a specified number.
public static void Main() { double[] numbers = {-1, 0, .105, .5, .798, 1, 4, 6.9, 10, 50, 100, 500, 1000, Double.MaxValue}; foreach (double number in numbers) { // C# Extension Method: Double - Log10 Console.WriteLine("The base 10 log of {0} is {1}.", number, number.Log10()); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns the base 10 logarithm of a specified number. /// </summary> /// <param name="d">A number whose logarithm is to be found.</param> /// <returns> /// One of the values in the following table. parameter Return value Positive The base 10 log of ; that is, log /// 10. Zero Negative Equal to Equal to. /// </returns> public static Double Log10(this Double d) { return Math.Log10(d); } }