This is the mail archive of the gsl-discuss@sourceware.org mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0)


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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]