Skip Menu |

This queue is for tickets about the Math-Vec CPAN distribution.

Report information
The Basics
Id: 25373
Status: resolved
Worked: 1.5 hours (90 min)
Priority: 0/
Queue: Math-Vec

People
Owner: Nobody in particular
Requestors: barry.crabtree [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: The method 'InnerAngle' sometimes returns a complex number.
Date: Sun, 11 Mar 2007 18:54:04 +0000
To: bug-Math-Vec [...] rt.cpan.org
From: "Barry Crabtree" <barry.crabtree [...] gmail.com>
The method 'InnerAngle' sometimes returns a complex number. Seems to be when the angle is about 180 degrees. Math::Vec version 0.04 Perl: This is perl, v5.8.7 built for i486-linux-gnu-thread-multi OS: Linux jitterbug 2.6.15-27-386 #1 PREEMPT Fri Dec 8 17:51:56 UTC 2006 i686 GNU/Linux Reproduced with: ---------------------------------- #!/usr/bin/perl -w use strict; use Math::Vec; my ($x1, $y1, $x2, $y2, $x3, $y3) = (184.818732905007, 1.88127517013888, 183.75578943, 1.9146946049724, 182.742125596, 1.94656466818785, ); my $v1 = Math::Vec->new($x2-$x1, $y2-$y1); my $v2 = Math::Vec->new($x2-$x3, $y2-$y3); my $angle = $v1->InnerAngle($v2); print "Angle is: $angle\n"; --------------------------------- prints: Angle is: 3.14159265358979-2.98023223876953e-08i It seems to be more common on amd 64 bit machines ( http://lists.openstreetmap.org/pipermail/dev/2007-March/003380.html) Hope this helps. Cheers. Barry. -- Live as if you were to die tomorrow. Learn as if you were to live forever. - Gandhi.
Solved in 1.01 by not using Math::Complex::acos Thanks