Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c#
log10
math
communitycreator

What is Math.Log10() in C#?

Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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 the Double type and represents the input value for which we have to find Log10(). Its range is all double numbers.

Return value

  • Double: This returns a positive Double number representing the base 10 log of the value.

  • NaN: This returns an input of negative or NaN in value.

  • PositiveInfinity: This returns an input of PositiveInfinity in value.

  • NegativeInfinity: This returns an input of 0 in value.

value is 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);
}
}

RELATED TAGS

c#
log10
math
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring