public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Brian Gough <bjg@network-theory.co.uk>
To: Charlie Zender <zender@uci.edu>
Cc: GSL Discussion List <gsl-discuss@sources.redhat.com>
Subject: Re: Two possible problems with gsl_complex behavior
Date: Wed, 19 Dec 2001 13:20:00 -0000	[thread overview]
Message-ID: <15202.43252.769410.907235@debian> (raw)
In-Reply-To: <200107271646.f6RGkMV06065@cgd85.cgd.ucar.edu>

Charlie Zender writes:
 > First, and least troublesome, is that the result of
 > gsl_complex_cos(gsl_complex z) where z=(0.0,0.0) does not appear to
 > be exactly (1.0,0.0), but rather (1.0,-0.0). 

Thanks for the bug reports.  

For cos(z) I've adjusted the code so that the sign of zero is positive
for Im(z) = 0.  

The negative sign was a result of the identity used to calculate the
imaginary part,

  cos(x+iy) = cosh(x) cos(y) - i sin(x) sinh(y)

 > Second, and more troublesome, is the behavior of gsl_complex functions
 > when used as arguments to other functions. Again, using g++-2.96, the
 > following used to work in gsl-0.7 "as expected":
 > 
 > float_complex cpx=(0.0,0.0);
 > gsl_complex ngl_cos=gsl_complex_cos(gsl_complex_rect(cpx.real(),cpx.imag())); 

I had a quick look and this function does not appear to have changed
between 0.7 and 0.9 apart from,

-- the name being changed from gsl_complex_xy() to gsl_complex_rect()

-- the addition of an inline version in the header file, wrapped with
#ifdef HAVE_INLINE (so this should not cause any change unless
compiling the test program with -DHAVE_INLINE)

I tried compiling with g++ 2.95 and it worked ok.

Before I investigate more did you try compiling with -Wall and other
warning options?  Also, you know that the initializer should be
float_complex cpx(0.0,0.0); rather than =(0.0,0.0); right?

regards
Brian Gough

      reply	other threads:[~2001-12-19 13:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-19 13:20 Charlie Zender
2001-12-19 13:20 ` Brian Gough [this message]

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=15202.43252.769410.907235@debian \
    --to=bjg@network-theory.co.uk \
    --cc=gsl-discuss@sources.redhat.com \
    --cc=zender@uci.edu \
    /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).