octave-maintainers
[Top][All Lists]
Advanced

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

Re: Complex mappers for real values


From: Dmitri A. Sergatskov
Subject: Re: Complex mappers for real values
Date: Thu, 22 Jun 2017 12:47:49 -0500

On Thu, Jun 22, 2017 at 12:30 PM, Mike Miller <address@hidden> wrote:
On Thu, Jun 22, 2017 at 10:14:26 -0700, Mike Miller wrote:
> According to cppreference [1], std::conj(double) should return a
> std::complex<double>. Under gcc's libstdc++, the return value is a
> double. Using clang's libc++, the return value is a
> std::complex<double>.

I forgot the link

  [1] http://en.cppreference.com/w/cpp/numeric/complex/conj

using sample code with
​gcc-4.8.5/gcc-7.1.1/clang-4.0.0 (with either libc++ or libstdc++) all give
the same (correct) answer.

If I use Carnë Draug's code from the old thread

https://lists.gnu.org/archive/html/octave-maintainers/2016-08/msg00090.html

cat t1.cc
    #include <iostream>
    #include <complex>
    #include <typeinfo>

    int main()
    {
      std::cout << typeid (std::conj (double (5.0))).name() << std::endl;
    }


gcc-4.8.5 returns
g++ -std=c++11 t1.cc
d

(gcc 7.1.1)  g++ t1.cc
./a.out
St7complexIdE

(clang 4.0.0)
clang++ -std=c++11 t1.cc
./a.out
St7complexIdE

clang++ -std=c++11 -stdlib=libc++ t1.cc
./a.out
NSt3__17complexIdEE

Not sure how it is all relevent, but just fyi.

--
mike


​Dmitri.
--


reply via email to

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