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

Re: round-off error in std::pow(std::complex<T>, double) in C++11


On Fri, 25 Jan 2013, Gabriel Dos Reis wrote:
[ pow(z,4) ]
Why can't we be both fast and correct when the second
argument is an integer?

I just meant that squaring twice (rounding in between) probably doesn't yield the correct result (i.e. computing with infinite precision and only rounding once at the end). It is probably still possible to do something better than the general case when the second argument is an integer, but it isn't obvious.


Now if all platforms are like glibc and provide an imprecise pow implementation, we are not losing anything by adding a simple integer implementation.

The standard replaced code with prose/comments -- e.g. the
contrary of what we would like to do.

On the other hand, we can interpret it as giving us all the freedom we need to write those integer overloads.


--
Marc Glisse


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