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 01/25/2013 01:54 PM, Marc Glisse wrote:

Implementing this optimization in the compiler when the exponent is a
compile-time constant seems like a good and simple idea in any case :-)

If that was done, would a function like


  bool foo (std::complex<double>& x, int y)
  {
     return std::pow (x, y) == std::pow (x, 2);
  }

maybe return fals if called with y = 2, assuming the compiler could not determine the value of y at compile time?

That seems like a bad feature to me.

jwe


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