cos是假设X以弧度为单位的三角函数余弦。
cos(X)
*PI = \3.1415926535; $a = 30; # in degrees $cos = cos($a/180*$PI); print "cos(" . $a . "°) = " . $cos . "\n";