![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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.Exp() Method in C#
The Math.Exp() method in C# is used to return e raised to the specified power.
Syntax
public static double Exp (double val);
Here, Val is the power.
If Val equals NaN or PositiveInfinity, that value is returned. However, if d equals NegativeInfinity, 0 is returned.
Let us now see an example to implement Math.Exp() method −
Example
using System; public class Demo { public static void Main(){ Console.WriteLine(Math.Exp(0.0)); Console.WriteLine(Math.Exp(Double.PositiveInfinity)); Console.WriteLine(Math.Exp(Double.NegativeInfinity)); } }
Output
This will produce the following output −
1 ∞ 0
Let us see another example to implement Math.Exp() method −
Example
using System; public class Demo { public static void Main(){ Console.WriteLine(Math.Exp(10.0)); Console.WriteLine(Math.Exp(Double.NaN)); } }
Output
This will produce the following output −
22026.4657948067 NaN
Advertisements