# Python | Decimal exp() method

Decimal#exp() : exp() is a Decimal class method which returns the value of the (natural) exponential function e**x at the given number

Syntax: Decimal.exp()

Parameter: Decimal values

Return: the value of the (natural) exponential function e**x at the given number

Code #1 : Example for exp() method

 `# Python Program explaining  ` `# exp() method ` ` `  `# loading decimal library ` `from` `decimal ``import` `*` ` `  ` `  `# Initializing a decimal value ` `a ``=` `Decimal(``-``1``) ` ` `  `b ``=` `Decimal(``'0.142857'``) ` ` `  `# printing Decimal values ` `print` `(``"Decimal value a : "``, a) ` `print` `(``"Decimal value b : "``, b) ` ` `  ` `  `# Using Decimal.exp() method ` `print` `(``"\n\nDecimal a with exp() method : "``, a.exp()) ` ` `  `print` `(``"Decimal b with exp() method : "``, b.exp()) `

Output :

```Decimal value a :  -1
Decimal value b :  0.142857

Decimal a with exp() method :  0.3678794411714423215955237702
Decimal b with exp() method :  1.153564830100120253802476512

```

Code #2 : Example for exp() method

 `# Python Program explaining  ` `# exp() method ` ` `  `# loading decimal library ` `from` `decimal ``import` `*` ` `  ` `  `# Initializing a decimal value ` `a ``=` `Decimal(``'-3.14'``) ` ` `  `b ``=` `Decimal(``'7.555'``) ` ` `  `# printing Decimal values ` `print` `(``"Decimal value a : "``, a) ` `print` `(``"Decimal value b : "``, b) ` ` `  ` `  `# Using Decimal.exp() method ` `print` `(``"\n\nDecimal a with exp() method : "``, a.exp()) ` ` `  `print` `(``"Decimal b with exp() method : "``, b.exp()) `

Output :

```Decimal value a :  -3.14
Decimal value b :  7.555

Decimal a with exp() method :  0.04328279790196590079772976615
Decimal b with exp() method :  1910.270243928773816178935745
```

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

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.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.