round-off error in std::pow(std::complex<T>, double) in C++11
Paolo Carlini
paolo.carlini@oracle.com
Fri Jan 25 16:34:00 GMT 2013
On 01/25/2013 05:18 PM, 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. In other terms it seems that to actually get 0 we really have
> to handle separately (small) integer exponents, as Marc mentioned in
> the PR. Then again, is this overall a libstdc++ issue or it would make
> sense to have the (..., int) overloads restored at the *ISO* level?
... or, alternately, just forward to the builtins (at least when not
fast math) and have the builtins handle in an optimized way an exponent
which is a small integer. I'm not at all convinced that when the
Standard removes the (..., int) overloads we want to red-add the
overloads back in the library as an implementation detail. I suppose my
stance is clear at this point ;)
Paolo.
More information about the Libstdc++
mailing list