# Math.Exp Method

Silverlight

Returns e raised to the specified power.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

## Syntax

```'Declaration
<SecuritySafeCriticalAttribute> _
Public Shared Function Exp ( _
d As Double _
) As Double
```

#### Parameters

d
Type: System.Double
A number specifying a power.

#### Return Value

Type: System.Double
The number e raised to the power d. If d equals NaN or PositiveInfinity, that value is returned. If d equals NegativeInfinity, 0 is returned.

## Remarks

Use the Pow method to calculate powers of other bases.

Exp is the inverse of Log.

## Examples

The following example uses Exp to evaluate certain exponential and logarithmic identities for selected values.

```
' Example for the Math.Exp( Double ) method.

Module Example

Public Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
outputBlock.Text &= _
"This example of Math.Exp( Double ) " & _
"generates the following output." & vbCrLf & vbCrLf
outputBlock.Text &= _
"Evaluate [e ^ ln(X) == ln(e ^ X) == X] " & _
"with selected values for X:" & vbCrLf

UseLnExp(outputBlock, 0.1)
UseLnExp(outputBlock, 1.2)
UseLnExp(outputBlock, 4.9)
UseLnExp(outputBlock, 9.9)

outputBlock.Text &= vbCrLf & _
"Evaluate these identities with selected values for X and Y:" & vbCrLf
outputBlock.Text &= "   (e ^ X) * (e ^ Y) = e ^ (X + Y)" & vbCrLf
outputBlock.Text &= "   (e ^ X) ^ Y = e ^ (X * Y)" & vbCrLf
outputBlock.Text &= "   X ^ Y = e ^ (Y * ln(X))" & vbCrLf

UseTwoArgs(outputBlock, 0.1, 1.2)
UseTwoArgs(outputBlock, 1.2, 4.9)
UseTwoArgs(outputBlock, 4.9, 9.9)
End Sub 'Main

' Evaluate logarithmic/exponential identity with a given argument.
Sub UseLnExp(ByVal outputBlock As System.Windows.Controls.TextBlock, ByVal arg As Double)

' Evaluate e ^ ln(X) = ln(e ^ X) = X.
outputBlock.Text &= String.Format( _
vbCrLf & "      Math.Exp(Math.Log({0})) = {1:E16}" + _
vbCrLf & "      Math.Log(Math.Exp({0})) = {2:E16}", _
arg, Math.Exp(Math.Log(arg)), Math.Log(Math.Exp(arg))) & vbCrLf
End Sub 'UseLnExp

' Evaluate exponential identities that are functions of two arguments.
Sub UseTwoArgs(ByVal outputBlock As System.Windows.Controls.TextBlock, ByVal argX As Double, ByVal argY As Double)

' Evaluate (e ^ X) * (e ^ Y) = e ^ (X + Y).
outputBlock.Text &= String.Format( _
vbCrLf & "Math.Exp({0}) * Math.Exp({1}) = {2:E16}" + _
vbCrLf & "          Math.Exp({0} + {1}) = {3:E16}", _
argX, argY, Math.Exp(argX) * Math.Exp(argY), _
Math.Exp((argX + argY))) & vbCrLf

' Evaluate (e ^ X) ^ Y = e ^ (X * Y).
outputBlock.Text &= String.Format( _
" Math.Pow(Math.Exp({0}), {1}) = {2:E16}" + _
vbCrLf & "          Math.Exp({0} * {1}) = {3:E16}", _
argX, argY, Math.Pow(Math.Exp(argX), argY), _
Math.Exp((argX * argY))) & vbCrLf

' Evaluate X ^ Y = e ^ (Y * ln(X)).
outputBlock.Text &= String.Format( _
"           Math.Pow({0}, {1}) = {2:E16}" + _
vbCrLf & "Math.Exp({1} * Math.Log({0})) = {3:E16}", _
argX, argY, Math.Pow(argX, argY), _
Math.Exp((argY * Math.Log(argX)))) & vbCrLf

End Sub 'UseTwoArgs
End Module 'ExpDemo

' This example of Math.Exp( Double ) generates the following output.
'
' Evaluate [e ^ ln(X) == ln(e ^ X) == X] with selected values for X:
'
'       Math.Exp(Math.Log(0.1)) = 1.0000000000000001E-001
'       Math.Log(Math.Exp(0.1)) = 1.0000000000000008E-001
'
'       Math.Exp(Math.Log(1.2)) = 1.2000000000000000E+000
'       Math.Log(Math.Exp(1.2)) = 1.2000000000000000E+000
'
'       Math.Exp(Math.Log(4.9)) = 4.9000000000000012E+000
'       Math.Log(Math.Exp(4.9)) = 4.9000000000000004E+000
'
'       Math.Exp(Math.Log(9.9)) = 9.9000000000000004E+000
'       Math.Log(Math.Exp(9.9)) = 9.9000000000000004E+000
'
' Evaluate these identities with selected values for X and Y:
'    (e ^ X) * (e ^ Y) = e ^ (X + Y)
'    (e ^ X) ^ Y = e ^ (X * Y)
'    X ^ Y = e ^ (Y * ln(X))
'
' Math.Exp(0.1) * Math.Exp(1.2) = 3.6692966676192444E+000
'           Math.Exp(0.1 + 1.2) = 3.6692966676192444E+000
'  Math.Pow(Math.Exp(0.1), 1.2) = 1.1274968515793757E+000
'           Math.Exp(0.1 * 1.2) = 1.1274968515793757E+000
'            Math.Pow(0.1, 1.2) = 6.3095734448019331E-002
' Math.Exp(1.2 * Math.Log(0.1)) = 6.3095734448019344E-002
'
' Math.Exp(1.2) * Math.Exp(4.9) = 4.4585777008251705E+002
'           Math.Exp(1.2 + 4.9) = 4.4585777008251716E+002
'  Math.Pow(Math.Exp(1.2), 4.9) = 3.5780924170885260E+002
'           Math.Exp(1.2 * 4.9) = 3.5780924170885277E+002
'            Math.Pow(1.2, 4.9) = 2.4433636334442981E+000
' Math.Exp(4.9 * Math.Log(1.2)) = 2.4433636334442981E+000
'
' Math.Exp(4.9) * Math.Exp(9.9) = 2.6764450551890982E+006
'           Math.Exp(4.9 + 9.9) = 2.6764450551891015E+006
'  Math.Pow(Math.Exp(4.9), 9.9) = 1.1684908531676833E+021
'           Math.Exp(4.9 * 9.9) = 1.1684908531676829E+021
'            Math.Pow(4.9, 9.9) = 6.8067718210957060E+006
' Math.Exp(9.9 * Math.Log(4.9)) = 6.8067718210956985E+006

```

## Version Information

#### Silverlight

Supported in: 5, 4, 3

#### Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

#### XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

## Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.