Built-in Perl Arithmetic Functions
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).
Related examples in the same category