In C#, Exp() is a Math class method which is used to return the e raised to the specified power. Here e is a mathematical constant whose value is approximately 2.71828. Exp() is the inverse of Log().
Syntax:
public static double Exp (double num);
Parameter:
num: It is the required number of type System.Double which specifies a power.
Return Type: It returns a number e raised to the power num of type System.Double.
Note:
- If num is equal to NaN then the return value will be NaN.
- If num is equal to PositiveInfinity then the return value will be Infinity.
- If num is equal to NegativeInfinity then the return value will be 0.
Example 1:
// C# Program to illustrate the // Math.Exp(Double) Method using System; class Geeks { // Main Method public static void Main() { // using the method Console.WriteLine(Math.Exp(10.0)); Console.WriteLine(Math.Exp(15.57)); Console.WriteLine(Math.Exp(529.548)); Console.WriteLine(Math.Exp(0.00)); } } |
22026.4657948067 5780495.71030692 9.54496417945595E+229 1
Example 2:
// C# Program to illustrate the // Math.Exp(Double) Method by // taking NaN, PositiveInfinity // and NegativeInfinity] using System; class Geeks { // Main Method public static void Main() { // Taking NaN Console.WriteLine(Math.Exp(Double.NaN)); // Taking PositiveInfinity Console.WriteLine(Math.Exp(Double.PositiveInfinity)); // Taking NegativeInfinity Console.WriteLine(Math.Exp(Double.NegativeInfinity)); } } |
NaN Infinity 0
Reference: https://docs.microsoft.com/en-us/dotnet/api/system.math.exp?view=netcore-2.1
Recommended Posts:
- Difference between Method Overriding and Method Hiding in C#
- C# | Uri.MakeRelativeUri(Uri) Method
- Array.GetValue() Method in C# with Examples | Set - 1
- C# | CharEnumerator.MoveNext() Method
- C# | Math.IEEERemainder() Method
- C# | Substring() Method
- C# | IndexOfAny() Method
- C# | CharEnumerator.GetType() Method
- File.GetLastWriteTimeUtc() Method in C# with Examples
- MathF.Sin() Method in C# with Examples
- Double.CompareTo Method in C# with Examples
- C# | Graphics.DrawLine() Method | Set - 1
- UInt16.GetHashCode Method in C# with Examples
- Stack.Peek Method in C#
- C# | IsNullOrEmpty() Method
- C# | Math.Sign() Method
- Int64.CompareTo Method in C# with Examples
- C# | PadRight() Method
- How to use Array.BinarySearch() Method in C# | Set -1
- C# | EndsWith() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

