用法:Decimal.ln()
参数:十进制值
返回:十进制值的自然(以e为底)对数。
ln()使用方法示例:
#PythonProgramexplaining
#ln()method
#loadingdecimallibrary
fromdecimalimport*
#Initializingadecimalvalue
a=Decimal('.9932')
b=Decimal('0.142857')
#printingDecimalvalues
print("Decimalvaluea:",a)
print("Decimalvalueb:",b)
#UsingDecimal.ln()method
print("\n\nDecimalawithln()method:",a.ln())
print("Decimalbwithln()method:",b.ln())
输出:
Decimalvaluea:0.9932
Decimalvalueb:0.142857
Decimalawithln()method:-0.006823225348125508334064182053
Decimalbwithln()method:-1.945911149055813305438686327