Python‎ > ‎decimal‎ > ‎

Decimal.exp()

http://www.adilwaseem.com/

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

Syntax
Decimal(x).exp()

Parameters
x=Decimal value

Examples
The method return as:
 >>> Decimal(-23.99).exp()
Decimal('3.813075277214323280787091773E-11')
>>> Decimal(.99).exp()
Decimal('2.691234472349262265196915597')
>>> Decimal(0).exp()
Decimal('1')
>>>

if min(map(lambda(decimal,decimal)).__gt__()
The method returns with the minimum value in the sets equation set1/set2*set2 is greater than 2. 
from decimal import*
set1={Decimal(-1355).adjusted(),Decimal(-233.321).copy_negate(), Decimal(-23.99).exp()}
set2={ Decimal(2.0).fma(3,7),Decimal(1.1).log10()}
if min(map(lambda a,b: a/b*b, set1, set2)).__gt__(2):
        print("Return is greater than 2.")
else:
        print("Not within parameters")

>>> 
Return is greater than 2.
>>>       


list.append(decimal)
The method list the decimal value and limit the decimal point to '1.00' through quantize.
from decimal import Decimal
list1=list()
list.append((Decimal(2.10).copy_negate().quantize(Decimal('1.00')),
                                 Decimal(1.3).copy_sign(Decimal(1.3)).quantize(Decimal('1.00')),
                                    Decimal(3).exp().quantize(Decimal('1.00')))
)
print("The items in the list1 are:,", list1)

>>> 
The items in the list1 are:, [(Decimal('-2.10'), Decimal('1.30'), Decimal('20.09'))]
>>>


int(Decimal)
The method computed the int(value) of the decimal and then run loop through range() function.
from decimal import Decimal


for i in range(a,10):
    print(i)
    print(i/Decimal(1.1).log10())
        
>>>
0
0E+29
1
24.15885792809678504023429545
2
48.31771585619357008046859090
3
72.47657378429035512070288634
4
96.63543171238714016093718179
5
120.7942896404839252011714772
6
144.9531475685807102414057727
7
169.1120054966774952816400681
8
193.2708634247742803218743636
9
217.4297213528710653621086590
>>>



Comments