* gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0)
@ 2010-05-03 18:41 Rhys Ulerich
2010-05-03 18:46 ` Rhys Ulerich
2010-05-04 11:52 ` Brian Gough
0 siblings, 2 replies; 5+ messages in thread
From: Rhys Ulerich @ 2010-05-03 18:41 UTC (permalink / raw)
To: gsl-discuss
Hi all,
Using gsl_complex_pow_real to compute (0+0i)^0 incorrectly gives 0 as
the result. Try running
#include <stdio.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>
int main(int argc, char *argv[])
{
gsl_complex z = gsl_complex_pow_real(gsl_complex_rect(0,0), 0);
printf("(%g,%g)\n", GSL_REAL(z), GSL_IMAG(z));
}
which will output (0,0). I expect it to kick back (1,0). The
behavior for (1+0i)^0 and (0+1i)^0 looks correct.
Observed on GSL 1.14 with Intel 10.1 20090817 on Ubuntu 9.10 32bit.
Also on GSL 1.13 with Intel 10.1 20081024 on Ubuntu 8.04 64bit.
Also on GSL 1.12 with GCC 4.3.3 on Ubuntu 8.04 64bit.
I've not seen any references to this on the mailing list or in
savannah. Let me know if you'd like me to file a bug.
- Rhys
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0)
2010-05-03 18:41 gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0) Rhys Ulerich
@ 2010-05-03 18:46 ` Rhys Ulerich
2010-05-04 11:52 ` Brian Gough
1 sibling, 0 replies; 5+ messages in thread
From: Rhys Ulerich @ 2010-05-03 18:46 UTC (permalink / raw)
To: gsl-discuss
One thing I forgot to justify-- I expect (1,0) as a result below based
on similarity to gsl_sf_pow_int and the comments in pow_int.c stating
that gsl_sf_pow_int returns 0.0^0 = 1.0 for continuity.
Please disregard if the complaint is mathematically bogus with that
justification.
- Rhys
On Mon, May 3, 2010 at 1:40 PM, Rhys Ulerich <rhys.ulerich@gmail.com> wrote:
> Hi all,
>
> Using gsl_complex_pow_real to compute (0+0i)^0 incorrectly gives 0 as
> the result. Try running
>
> #include <stdio.h>
> #include <gsl/gsl_complex.h>
> #include <gsl/gsl_complex_math.h>
>
> int main(int argc, char *argv[])
> {
> gsl_complex z = gsl_complex_pow_real(gsl_complex_rect(0,0), 0);
> printf("(%g,%g)\n", GSL_REAL(z), GSL_IMAG(z));
> }
>
> which will output (0,0). I expect it to kick back (1,0). The
> behavior for (1+0i)^0 and (0+1i)^0 looks correct.
>
> Observed on GSL 1.14 with Intel 10.1 20090817 on Ubuntu 9.10 32bit.
> Also on GSL 1.13 with Intel 10.1 20081024 on Ubuntu 8.04 64bit.
> Also on GSL 1.12 with GCC 4.3.3 on Ubuntu 8.04 64bit.
>
> I've not seen any references to this on the mailing list or in
> savannah. Let me know if you'd like me to file a bug.
>
> - Rhys
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0)
2010-05-03 18:41 gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0) Rhys Ulerich
2010-05-03 18:46 ` Rhys Ulerich
@ 2010-05-04 11:52 ` Brian Gough
2010-05-06 4:06 ` Rhys Ulerich
[not found] ` <j2s4a00655d1005051949v110db7adzd8414490dfd31b0f@mail.gmail.com>
1 sibling, 2 replies; 5+ messages in thread
From: Brian Gough @ 2010-05-04 11:52 UTC (permalink / raw)
To: Rhys Ulerich; +Cc: gsl-discuss
At Mon, 3 May 2010 13:40:46 -0500,
Rhys Ulerich wrote:
> I've not seen any references to this on the mailing list or in
> savannah. Let me know if you'd like me to file a bug.
Thanks for finding that. Please do file a bug in the tracker at
http://savannah.gnu.org/bugs/?group=gsl. (A patch and test case would
also be handy!)
Looking at the source, there's an explicit check for 0^0 in
gsl_complex_pow but it is missing from gsl_complex_pow_real, so it
looks like a simple oversight.
--
Brian Gough
GNU Scientific Library -
http://www.gnu.org/software/gsl/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0)
2010-05-04 11:52 ` Brian Gough
@ 2010-05-06 4:06 ` Rhys Ulerich
[not found] ` <j2s4a00655d1005051949v110db7adzd8414490dfd31b0f@mail.gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Rhys Ulerich @ 2010-05-06 4:06 UTC (permalink / raw)
To: Brian Gough; +Cc: gsl-discuss
> Please do file a bug...
>
> Looking at the source, there's an explicit check for 0^0 in
> gsl_complex_pow but it is missing from gsl_complex_pow_real...
Bug filed with a patch adding a test case and another patch making the
test case pass. If you apply the first one and run make check, you'll
see it catch the error. Adds some warm fuzziness to the process.
I've not figured out how to change bug status in Savannah, only to
comment and attach files. Is there some additional authorization I'd
need to modify a severity, status, assign it, etc? Or am I just
having my usual dumb luck with web UIs?
- Rhys
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0)
[not found] ` <j2s4a00655d1005051949v110db7adzd8414490dfd31b0f@mail.gmail.com>
@ 2010-05-06 9:03 ` Brian Gough
0 siblings, 0 replies; 5+ messages in thread
From: Brian Gough @ 2010-05-06 9:03 UTC (permalink / raw)
To: Rhys Ulerich; +Cc: gsl-discuss
At Wed, 5 May 2010 21:49:18 -0500,
Rhys Ulerich wrote:
> Bug filed with a patch adding a test case and another patch making the test
> case pass. If you apply the first one and run make check, you'll see it
> catch the error. Adds some warm fuzziness to the process.
>
> I've not figured out how to change bug status in Savannah, only to comment
> and attach files. Is there some additional authorization I'd need to modify
> a severity, status, assign it, etc? Or am I just having my usual dumb luck
> with web UIs?
Thanks for handling that bug, you need permissions on the tracker to
change the status -- I've added you to the gsl savannah group so you
can do that.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-06 9:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-03 18:41 gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0) Rhys Ulerich
2010-05-03 18:46 ` Rhys Ulerich
2010-05-04 11:52 ` Brian Gough
2010-05-06 4:06 ` Rhys Ulerich
[not found] ` <j2s4a00655d1005051949v110db7adzd8414490dfd31b0f@mail.gmail.com>
2010-05-06 9:03 ` Brian Gough
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).