Professional Documents
Culture Documents
+,-,*,/,%
eg : $result=3+4;
$ftoc=(212-32)*(5/9);
$square=16*2;
the function automatically use the value of $ if you
fail to specify a variable on which to operate.
Abs---the absolute value
print abs(-1.295);
value will be printed as 1.295
Int converting floating points to integers
print int abs(-1.295);
printf(%.2f,abs(-1.295);
number to two decimal places
value will be 1.30.
0 is appended in the output to show the two
decimal places.
Exp---raising e to the power
exponential operator**
eg: $square=4**2;
value =16
The natural base number e to the power, you need to
use the exp function.
exp EXPR
exp
if didnt use EXPR argument, exp use value of the
$_variable as the exponent.
$square = exp(2);
Sqrtthe square root
square root of numberuse sqrt function
$var = sqrt(16384);
nth root** operator with a factional number
$ var=16384**(1/2);
The value will be 128
Cube root
Cube root of 16777216
$var= 16777216**(1/3);
Value will be 256.
Log logarithm
Logarithm(base e)use log function.
$log = log 1.43;
Trigonometric function
Three built-in trigonometric function
Arctangent squared (atan2)
Cosine (cos)
Sine (sin)
Eg: atan2 x,y
cos EXPR
sin EXPR
Arcsine, arccosine and tangent need to be access we
can use the POSIX module, it supplies acos, asin and tan
function.