programming-examples/perl/Basics/Built-in Perl Arithmetic Functions.pl

27 lines
932 B
Perl
Raw Normal View History

2019-11-18 14:44:36 +01:00
atan2(Y,X) Returns the arctangent of Y/X.
cos(EXPR)
cos EXPR Returns the cosine of EXPR in radians. If EXPR is omitted, takes cosine of $_.
exp(EXPR)
exp EXPR Returns e to the power of EXPR. If EXPR is omitted, gives exp($_).
int(EXPR)
int EXPR Returns the integer portion of EXPR. If EXPR is omitted, uses $_.
log(EXPR)
log EXPR Returns logarithm (base e) of EXPR. If EXPR is omitted, returns log of $_.
rand(EXPR)
rand EXPR
rand Returns a random fractional number between 0 and the value of EXPR.
If EXPR is omitted, returns a value between 0 and 1.
sin(EXPR)
sin EXPR Returns the sine of EXPR in radians. If EXPR is omitted, returns sine of $_.
sqrt(EXPR)
sqrt EXPR Return the square root of EXPR. If EXPR is omitted, returns square root of $_.
srand(EXPR)
srand EXPR Sets the random number seed for the rand operator. If EXPR is omitted, does srand(time).