Home Tutorials IT Jobs Source Codes Certifications Discussion Forum
  Perl Tutorials
Perl Introduction
Variables
Operators
Character Meanings
Control and Loops
Functions
Array Functions
String Functions
Math Functions
Reading and Writing
Using Cookies
Printing a file
Hit Counter
Poll Receiving
   IT Jobs
Software Jobs
Networking Jobs
   Model Question Papers
BE Computer Science
MCA
BCA
Others
 
   

Math Functions

Shows Perl math functions providing examples of how to use the functions and what they do.

If an expression is not passed to many of these functions, except where noted, the $_ value is used by default.

abs

The statement:

abs -100

evaluates to the value, 100.

atan2

This function returns the inverse tangent in radians. The returned value is -pi to +pi.

actan2 a,b

cos

The cosine in radians is returned.

cos VALUE

exp

Returns a value of the exponent (e) to the power of the passed value.

exp VALUE

int

Convert the value to an integer and truncate it if necessary.

int VALUE

log

Compute the natural log of the value. This is the inverse of the exp function.

log VALUE

rand

Return a random real number between 0 and the expression passed. If no value is passed, 1 is assumed and a value between 0 and 1 is returned.

rand VALUE

sin

The sine in radians is returned.

sin VALUE

sqrt

Returns the square root of the value.

sqrt VALUE

srand

Set the random number seed to the value passed. If no value is passed, a value is calculated based on process ID and current time.

srand VALUE

time

Returns the number of seconds since January 1, 1970.

<< Previous | Next >>

Home  |  About us  | Privacy  |  Disclaimer  |  Contact us |  Advertise with us | Our Link Partners
All Rights Reserved 2009, CodeTeller.com