That would be because I'm stupid and blindly copied sin_deg(), cos_deg() to asin_deg() and acos_deg().
Fix coming...
--d
Hill, Ronald wrote:
Hi All,
I am in the process of converting the DateTime-Event-Sunrise module to use the DateTime-util-calc module. The problem I am having is using the acos_deg function in the cals module does not product the same results as my acosd function. Can someone tell me how I can get these 2 functions to agree? Am I doing something wrong?
the output is:
F:\scripts>me.pl t using my method: 76.1440743101727 t using util method: 1.56661657821494
F:\scripts>
Here is a test script to demonstrate the problem.
use strict; use warnings; use Math::Trig; use DateTime::Util::Calc qw(acos_deg); my $RADEG = ( 180 / pi );
my $cost = 0.239481255754665;
my $t = acosd($cost);
my $z = acos_deg($cost);
print "t using my method: $t\n"; print "t using util method: $z\n";
sub acosd { ( $RADEG * acos( $_[0] ) ); }
__END__
from Pauls c code whis is what I use in my module
#define RADEG ( 180.0 / PI ) #define DEGRAD ( PI / 180.0 )
/* The trigonometric functions in degrees */
#define sind(x) sin((x)*DEGRAD) #define cosd(x) cos((x)*DEGRAD) #define tand(x) tan((x)*DEGRAD)
#define atand(x) (RADEG*atan(x)) #define asind(x) (RADEG*asin(x)) #define acosd(x) (RADEG*acos(x)) #define atan2d(y,x) (RADEG*atan2(y,x))
Thanks
Ron Hill