Perl | exp Function Last Updated : 06 Jan, 2022 Comments Improve Suggest changes Like Article Like Report The exp function in Perl calculates "e" raised to the power of the real number taken as the parameter. Here "e" is Euler’s Number or the base of the Natural system of logarithms or commonly known as an irrational number that approximates to 2.718281828, and is one of the most important mathematical constants. This "e" is broadly used in many occasions such as Compound Interests, Bernoulli trials, Normal Distribution, Calculus, and many more. Syntax: exp valueParameters: value: It is the real value which defines the power "e" has to be raised to.Returns: the value of e raised to the power of the given real value. Example 1: Perl #!/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 = exp $A; $F = exp $B; $G = exp $C; $H = exp $D; # 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"; Output: 1 2.71828182845905 22026.4657948067 485165195.40979 Example 2: Perl #!/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"; Output : 2.71828182845905 7.38905609893065 20.0855369231877 54.5981500331442 Comment More infoAdvertise with us Next Article Perl | exp Function K Kanchan_Ray Follow Improve Article Tags : Perl Perl-function Perl-Math-Functions Similar Reads Perl | abs() function This function returns the absolute value of its argument. If a pure integer value is passed then it will return it as it is, but if a string is passed then it will return zero. If VALUE is omitted then it uses $_ Syntax: abs(VALUE) Parameter: VALUE: It is a required number which can be either positi 2 min read Perl | cos() Function This function is used to calculate cosine of a VALUE or $_ if VALUE is omitted. The VALUE should be expressed in radians. Syntax: cos(VALUE) Parameters: VALUE in the form of radians Returns: Function returns cosine of VALUE. Example 1: Perl #!/usr/bin/perl # Calling cos function $var = cos(5); # Pri 1 min read Perl | atan2() Function This function is used to calculate arctangent of Y/X in the range -PI to PI. Syntax: atan2(Y, X) Parameters: Y and X which are axis values Returns: Function returns arctangent of Y/X in the range -PI to PI. Example1: Perl #!/usr/bin/perl # Assigning values to X and y $Y = 45; $X = 70; # Calling atan 1 min read Perl | oct() Function oct() function in Perl converts the octal value passed to its respective decimal value. For example, oct('1015') will return '525'. This function returns the resultant decimal value in the form of a string which can be used as a number because Perl automatically converts a string to a number in nume 1 min read Perl | log() Function log() function in Perl returns the natural logarithm of value passed to it. Returns $_ if called without passing a value. log() function can be used to find the log of any base by using the formula: Syntax: log(value) Parameter: value: Number of which log is to be calculated Returns: Floating point 2 min read Like