
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Math.Log10() Method in C#
The Math.Log10() method in C# is returned to the base 10 logarithms of a specified number.
Syntax
public static double Log10 (double val);
Here, Val is the number whose logarithm we want.
The Log10() method returns −
Val parameter | Returns |
---|---|
Positive | The base 10 log of d; that is, log 10d. |
Zero | NegativeInfinity |
Negative | NaN |
Equal to NaN | NaN |
Equal to PositiveInfinity | PositiveInfinity |
Let us now see an example to implement Math.Log10() method −
Example
using System; public class Demo { public static void Main(){ double val1 = Double.PositiveInfinity; ; double val2 = Double.NegativeInfinity; Console.WriteLine(Math.Log10(val1)); Console.WriteLine(Math.Log10(val2)); } }
Output
This will produce the following output −
∞ NaN
Let us see another example to implement Math.Log10() method −
Example
using System; public class Demo { public static void Main(){ double val1 = 0; double val2 = 1; double val3 = Double.NaN; Console.WriteLine(Math.Log10(val1)); Console.WriteLine(Math.Log10(val2)); Console.WriteLine(Math.Log10(val3)); } }
Output
This will produce the following output −
-∞ 0 NaN
Advertisements