This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/13450] std::pow(std::complex<double>(-1.,0.),0.5) yields (NaN,0)
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jan 2004 18:14:54 -0000
- Subject: [Bug libstdc++/13450] std::pow(std::complex<double>(-1.,0.),0.5) yields (NaN,0)
- References: <20031219173057.13450.pkienzle@nist.gov>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gdr at integrable-solutions dot net 2004-01-11 18:14 -------
Subject: Re: std::pow(std::complex<double>(-1.,0.),0.5) yields (NaN,0)
OK, I see what is going wrong. But the submitter's patch is not right
either. To properly implement the branch cut, we need to test whether
the imaginary part is a positive or negative zero (on IEEE-754
plateform). Yes that is a crazy notion -- but we got it.
Therefore we need a primitive that tells the sign of a real number.
I just looked at the GCC built-ins and there does not seem to be one.
You can't just test for > or < 0. And == 0 tells whether it is zero,
it does not tell whether it is negative or positive zero.
Furthermore, this is a template code, so we need to come up with a
design that scales to templates. This probably means we ought to
compute the log() unconditionally -- but then, I don't recall why I
made the previous change in the first place.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13450