This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libstdc++/13450] std::pow(std::complex<double>(-1.,0.),0.5) yields (NaN,0)


------- 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


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