public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Rhys Ulerich <rhys.ulerich@gmail.com>
To: gsl-discuss@sourceware.org
Subject: gsl_complex_pow_real(gsl_complex_rect(0,0),0) returns (0,0)
Date: Mon, 03 May 2010 18:41:00 -0000	[thread overview]
Message-ID: <s2k4a00655d1005031140z45745426i83b12d8e251c9bb2@mail.gmail.com> (raw)

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

             reply	other threads:[~2010-05-03 18:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03 18:41 Rhys Ulerich [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s2k4a00655d1005031140z45745426i83b12d8e251c9bb2@mail.gmail.com \
    --to=rhys.ulerich@gmail.com \
    --cc=gsl-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).