round-off error in std::pow(std::complex<T>, double) in C++11
Marc Glisse
marc.glisse@inria.fr
Fri Jan 25 16:41:00 GMT 2013
On Fri, 25 Jan 2013, Paolo Carlini wrote:
> On 01/25/2013 04:44 PM, Paolo Carlini wrote:
>> .. oops, I just noticed what Marc suggested in the PR about changing
>> pow(const complex<>&, const _Tp&) to *actually* forward to the complex
>> builtins when not fast math. That seems a good idea
> I have to add to this, however, that unless I did something badly wrong in a
> quick prototype, simply forwarding to the (complex, complex) builtin would
> *not* fix the round-off issue for this specific example.
Indeed, the glibc-2.13 version I have here gives a wrong rounding. As far
as I can see in svn, they still implement cpow(x,y) as cexp(y*clog(x)).
The inaccuracy issue seems known:
http://sourceware.org/bugzilla/show_bug.cgi?id=14473
I don't know if other platforms have an accurate cpow.
--
Marc Glisse
More information about the Libstdc++
mailing list