Double - Exp
Returns e raised to the specified power.
public static void Main() { double[] values = { 0.0, 1, 1.5, 3, 5, -7.6, 9, 45 }; Console.WriteLine("{0,7} {1,26}","Value","Exp\n"); foreach (double value in values) { // C# Extension Method: Double - Exp Console.WriteLine("{0,7} {1,26}", value, value.Exp()); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns e raised to the specified power. /// </summary> /// <param name="d">A number specifying a power.</param> /// <returns> /// The number e raised to the power . If equals or , that value is returned. If equals , 0 is returned. /// </returns> public static Double Exp(this Double d) { return Math.Exp(d); } }