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

Report information
The Basics
Id:
56577
Status:
open
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
simcop [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Important
Broken in:
(no value)
Fixed in:
(no value)



Subject: Incorrect results for some expressions
#!/usr/bin/perl use Math::Pari; my $base = PARI "-8"; my $exp = PARI "1/3"; print $base**$exp; __END__ The above code produces incorrect results. It should be giving back -2 (or some close approximation thereof), instead i'm getting 0.99999999999999999999999999999999999999+1.73205080756887729352744634150587236692376824824059149079*I which however is mathematically related (take the square root of the conjugate of that and you'll get the right answer). i'm still looking into where this is happening it might be in the underlying PARI library in which case this bug should be closed.
On Tue Apr 13 23:50:09 2010, SIMCOP wrote:
Show quoted text
> #!/usr/bin/perl > > use Math::Pari; > > my $base = PARI "-8"; > my $exp = PARI "1/3"; > > print $base**$exp; > > __END__ > > The above code produces incorrect results. It should be giving back > -2 > (or some close approximation thereof), instead i'm getting >
0.99999999999999999999999999999999999999+1.73205080756887729352744634150587236692376824824059149079*I
Show quoted text
> > which however is mathematically related (take the square root of the > conjugate of that and you'll get the right answer). i'm still looking > into where this is happening it might be in the underlying PARI > library > in which case this bug should be closed.
And i should have waited until pari proper was done compiling here, it does the same thing, rejecting bug since i'll be filling one upstream.
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #56577] Incorrect results for some expressions
Date: Wed, 14 Apr 2010 00:05:52 -0700
To: Ryan Voots via RT <bug-Math-Pari@rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
On Tue, Apr 13, 2010 at 11:50:11PM -0400, Ryan Voots via RT wrote:
Show quoted text
> The above code produces incorrect results. It should be giving back -2 > (or some close approximation thereof), instead i'm getting > 0.99999999999999999999999999999999999999+1.73205080756887729352744634150587236692376824824059149079*I > > which however is mathematically related (take the square root of the > conjugate of that and you'll get the right answer). i'm still looking > into where this is happening it might be in the underlying PARI library > in which case this bug should be closed.
The answer is correct. See the definition of phase of complex numbers (in PARI it is between -pi and pi not including -pi, IIRC). Hope this helps, Ilya


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.