octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Marc Glisse
Subject: Re: round-off error in std::pow(std::complex<T>, double) in C++11
Date: Fri, 25 Jan 2013 20:54:29 +0100 (CET)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]