Perl Programming/Keywords/cos
< Perl Programming | Keywords
The cos keyword
[edit | edit source]cos is the trigonometric function cose that assumes that X is in radians.
Syntax
[edit | edit source] cos(X)
Examples
[edit | edit source]![](http://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Crystal_Clear_action_apply.png/20px-Crystal_Clear_action_apply.png)
*PI = \3.1415926535;
$a = 30; # in degrees
$cos = cos($a/180*$PI);
print "cos(" . $a . "°) = " . $cos . "\n";