C# Math.Exp() – Examples
In this tutorial, we will learn about the C# Math.Exp() method, and learn how to use this method to calculate e raised to a specified power, with the help of examples.
Exp(Double)
Math.Exp(d) returns e raised to the specified power d.
Syntax
The syntax of Exp() method is
Math.Exp(Double d)
where
| Parameter | Description | 
|---|---|
| d | The power. | 
Return Value
The method returns value of type Double.
Example 1 – Exp(1)
In this example, we will find the value of e raised to the power of 1. So, Exp() should return the value of e.
C# Program
using System;
class Example {
    static void Main(string[] args) {
        Double d = 1;
        Double result = Math.Exp(d);
        Console.WriteLine($"e^{d} = {result}");
    }
}
Output
e^1 = 2.71828182845905
Example 2 – Exp(2.5)
In this example, we will find the value of e raised to the power of 2.5 using Math.Exp() method.
C# Program
using System;
class Example {
    static void Main(string[] args) {
        Double d = 2.5;
        Double result = Math.Exp(d);
        Console.WriteLine($"e^{d} = {result}");
    }
}
Output
e^2.5 = 12.1824939607035
Example 3 – Exp(Positive Infinity)
In this example, we will find the value of e raised to the power of positive infinity. Since the value of e is 2.718 which is greater than 1, then e raised to the power of positive infinity should result positive infinity.
C# Program
using System;
class Example {
    static void Main(string[] args) {
        Double d = Double.PositiveInfinity;
        Double result = Math.Exp(d);
        Console.WriteLine($"e^{d} = {result}");
    }
}
Output
e^∞ = ∞
Example 4 – Exp(Negative Infinity)
In this example, we will find the value of e raised to the power of negative infinity. Since the value of e is 2.718 which is greater than 1, then e raised to the power of negative infinity should result zero.
C# Program
using System;
class Example {
    static void Main(string[] args) {
        Double d = Double.NegativeInfinity;
        Double result = Math.Exp(d);
        Console.WriteLine($"e^{d} = {result}");
    }
}
Output
e^-∞ = 0
Example 5 – Exp(Zero)
In this example, we will find the value of e raised to the power of zero. We know that any number to the power of zero is one. So, in this case, Math.Exp(0) should return 1.
C# Program
using System;
class Example {
    static void Main(string[] args) {
        Double d = 0;
        Double result = Math.Exp(d);
        Console.WriteLine($"e^{d} = {result}");
    }
}
Output
e^0 = 1
Conclusion
In this C# Tutorial, we have learnt the syntax of C# Math.Exp() method, and also learnt how to use this method with the help of C# example programs.
