Perl exp函数
这里的 “e “是欧拉数或自然对数系统的基数,通常被称为无理数,近似于2.718281828,是最重要的数学常数之一。这个 “e “被广泛用于许多场合,如复合利息、伯努利试验、正态分布、微积分等等。
语法: exp value
参数:
value: 它是定义 “e “必须被提升到的幂的实值。
返回: e的值被提升到给定实值的幂。
例子 1 :
#!/usr/bin/perl
# Initialising some values for the
# parameter of the exp function
A = 0;B = 1;
C = 10;D = 20;
# Calling the exp function
E = expA;
F = expB;
G = expC;
H = expD;
# Getting the value of "e" raised to the
# power of the given parameter.
print "E\n";
print "F\n";
print "G\n";
print "H\n";
输出
1
2.71828182845905
22026.4657948067
485165195.40979
例2 :
#!/usr/bin/perl
# Calling the exp function
# Without Initializing values to variables
A = exp 1;B = exp 2;
C = exp 3;D = exp 4;
# Getting the value of "e" raised to the
# power of values taken as the parameter.
print "A\n";
print "B\n";
print "C\n";
print "D\n";
输出:
2.71828182845905
7.38905609893065
20.0855369231877
54.5981500331442