[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Trig Trouble



In Math::Trig, there are already deg2rad() and rad2deg() functions.   
For example:

#!/usr/sbin/perl -w

use Math::Trig;

$angle = 30.; # example
$angRad = deg2rad($angle);

print "in degrees, angle=$angle\n";
print "in radians, angle=$angRad\n";
$x = pi;
print "pi is: $x\n";


> From: Brian McNett <webmaster@mycoinfo.com>
> Greg--
>
> Having recently done some very similar trig, I suggest the following: 
>
> Go ahead and try Math::Trig.  This defines many additional trig  
functions
> beyond sin(), cos() and atan2().  No need to reinvent the wheel.
>
> If not the above, try more accurate values for your constants:
>
> $pi = atan2(1,1) * 4.0;
> $degress  =  360/($pi * 2)
>

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org