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: Mike Miller
Subject: Re: Complex mappers for real values
Date: Thu, 22 Jun 2017 10:14:26 -0700
User-agent: NeoMutt/20170306 (1.8.0)

On Wed, Jun 21, 2017 at 20:40:14 -0700, Rik wrote:
> // C++ now provides versions of the following functions for arguments of
> // type std::complex<T> and T.  But some compilers (I'm looking at you,
> // clang) apparently don't get this right yet...  So we provide our own
> // wrappers for real-valued arguments.

Actually it may be more accurate to say that clang has the correct
prototype, gcc does not.

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>.

Octave wants the conj function to return the same type that was passed
in, which disagrees with the C++ specification.

This may be a peculiarity of conj, the other functions mentioned do
return the same type that they were passed, either complex or
non-complex. Is it clearer to have an adapter only for conj and leave
out the others? Or to provide all of them in liboctave for symmetry?

-- 
mike



reply via email to

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