$pi = 4 * atan2(1, 1);

$e  = exp(1);

sub floor { $_[0]<0 ? int($_[0]-.999999999999999) : int($_[0]) }

sub ceil  { $_[0]<0 ? int($_[0]) : int($_[0]+.999999999999999) }

sub round { int($_[0] + .5*($_[0] <=> 0)) }

sub deg2rad { $_[0] * $pi / 180 }

sub rad2deg { $_[0] * 180 / $pi }

sub tan { sin($_[0]) / cos($_[0]) }

sub cot { cos($_[0]) / sin($_[0]) }

sub sec { 1 / cos($_[0]) }

sub csc { 1 / sin($_[0]) }

sub atan { atan2($_[0], 1) }

sub asin { abs($_[0])>1 ? undef : atan2($_[0], sqrt(1 - $_[0]*$_[0])) }

sub acos { abs($_[0])>1 ? undef : atan2(sqrt(1 - $_[0]*$_[0]), $_[0]) }

sub sinh { (exp($_[0]) - exp(-$_[0])) / 2 }

sub cosh { (exp($_[0]) + exp(-$_[0])) / 2 }

sub tanh { (exp(2*$_[0])-1) / (exp(2*$_[0])+1) }

sub asinh { log($_[0] + sqrt($_[0]*$_[0] + 1)) }

sub acosh { $_[0]<1 ? undef : log($_[0] + sqrt($_[0]*$_[0] - 1)) }

sub atanh { abs($_[0])>1 ? undef : log((1 + $_[0])/(1 - $_[0])) / 2 }

sub log10 { log($_[0]) / log(10) }

搗蛋鬼 發表在 痞客邦 PIXNET 留言(0) 人氣()