bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gsl] gsl_complex_pow() returns unexpected value


From: Patrick Alken
Subject: Re: [Bug-gsl] gsl_complex_pow() returns unexpected value
Date: Thu, 15 Sep 2016 11:37:20 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hello,
 
  I am unable to reproduce the issue - it is working correctly for me
(using the latest version 2.2.1). See below. Can you try using the
latest 2.2.1 and if you still see a problem, please send me an example
program.

$ cat pow.c
#include <stdio.h>
#include <stdlib.h>

#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>

int
main()
{
  gsl_complex a = gsl_complex_rect(0.0, 9.0);
  gsl_complex b = gsl_complex_rect(2.0, 0.0);
  gsl_complex c = gsl_complex_pow(a, b);

  fprintf(stderr, "c = %.12e + %.12e i\n", GSL_REAL(c), GSL_IMAG(c));

  return 0;
}

$ gcc -g -Wall -o pow pow.c -lm -lgsl -lgslcblas
$ ./pow
c = -8.100000000000e+01 + 9.919639073094e-15 i

Note that I see the same imaginary part you wrote, except with an
exponent of -15 instead of +15

On 09/05/2016 06:49 AM, David McMackins wrote:
> I'm writing a calculator application which uses the GSL as the backend
> for math operations with complex numbers. When I make a call to
> gsl_complex_pow() with the arguments of 0+9i and 2+0i, I get back
> -81+9.919639073e+15i, instead of just -81+0i as expected.
>
> I'm using libgsl 1.16 as packaged in Debian unstable currently.
>
> Happy Hacking,
>
> David E. McMackins II
> Associate Member, Free Software Foundation (#12889)
>
> www.mcmackins.org www.delwink.com
> www.gnu.org www.fsf.org
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]