Some parts of this page were machine translated.
Powered by Yandex.Translate
http://translate.yandex.com/
In the Perl programming language has a built-in function exp()
.
exp()
in Perl
In the Perl programming language has a built-in function exp()
.
Function log()
returns the base of natural logarithm to the specified power:
#!/usr/bin/perl
use feature qw(say);
say exp(0); # 1
say exp(1); # 2.71828182845905
say exp(2); # 7.38905609893065
say exp(3); # 20.0855369231877
If the function log()
not given no arguments, the function works with a variable $_
:
In this example, the variable $_
contains undef
, the function works exactly the same as log(0)
, returns 1
, but still
additionally, a warning is displayed Use of uninitialized value $_ in exp at script.pl line 6.
due to the fact that in the code there is a line use warnings;
:
#!/usr/bin/perl
use strict;
use warnings;
print exp();
Standard using exp()
is to pass it a single argument.
If the transfer function exp()
more than one argument, it will be an error and code execution will be stopped.
Too many arguments for exp at script.pl line 3, near "2)"
Execution of script.pl aborted due to compilation errors.
Function exp()
always returns a number.
Here is the output of the command perldoc -f exp
:
exp EXPR
exp Returns *e* (the natural logarithm base) to the power of EXPR.
If EXPR is omitted, gives "exp($_)".