octave-maintainers
[Top][All Lists]
Advanced

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

Re: Welcome C++11!


From: Júlio Hoffimann
Subject: Re: Welcome C++11!
Date: Wed, 26 Dec 2012 12:51:47 -0300

Most of the failures when compiling with C++11 are related to a serious bug in std::complex<> on GCC 4.6 branch as discussed here: http://gcc.gnu.org/ml/gcc-bugs/2011-04/msg02522.html.

Unfortunately, this bug won't be fixed in 4.6. It's already fixed in 4.7.

You can test the bug with a small snippet:
std::complex(0, std::numeric_limits<double>::inf());
If one of the arguments to the constructor is infinity, the other is messed up when C++11 is enabled.

Therefore, GNU Octave is passing almost all the tests as before. :)

Júlio.


2012/12/14 Ed Meyer <address@hidden>


On Fri, Dec 14, 2012 at 9:19 AM, Ed Meyer <address@hidden> wrote:


On Fri, Dec 14, 2012 at 5:50 AM, Jordi Gutiérrez Hermoso <address@hidden> wrote:
On 13 December 2012 23:45, Ed Meyer <address@hidden> wrote:

> that did it, but now it fails 2 tests involving pow. With the old
> std i^2 yields -1 exactly because the implementation of pow in
> /usr/include/c++/4.7/complex accounts for the fact that 2 is an even
> integer; it's wrapped with #ifndef __GXX_EXPERIMENTAL_CXX0X__ The
> new pow just does a polar(y*cos(log(x)), y*sin(log(x))) which
> because of roundoff leaves a tiny value (1.2e-16) in the imag part.
>
> I suppose realpow.m should check the imag part and cast the result
> to real if it is tiny instead of returning an error - what do you
> think?

Could this reasonably be considered a bug in the libstdc++
implementation? It sounds like they removed a check for even numbers
for no reason?

- Jordi G. H.

I'm guessing they would not consider this a bug, rather a feature that hasn't been
implemented yet. They haven't implemented pow(complex<T>, int) for c++11 so
the int arg gets cast to double and pow(complex<T>,T) gets called instead.
 I'm trying to figure out from their comments why they did this.

--
Ed Meyer


It looks to me like removing pow(complex<T>,int) was intentional and permanent
in order to be compatible with C99:

http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#844

--
Ed Meyer



reply via email to

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