template <typename T>
std::tuple<std::complex<T>,std::complex<T>,std::complex<T> > cbrt (std::complex<T> const &c)


On Tue, Oct 25, 2022 at 11:48 AM Dejan Milosavljevic <> wrote:
Cubic root have three solutions.
What is the rule to uniquely pick the first one?
Rest of them we can have by multiply with cbrt( {+1,0} );

My proposal for complex cbrt:
 template< typename T/*number like*/>
  std::complex<T> cbrt(  std::complex<T>  const& c, int index =0 /*  which root to use is defined by ( index  % 3)  0,1 or 2 */  );

This might be too complex.
Any idea to make it simple?

On Tue, Oct 25, 2022 at 5:01 PM Jason C via Std-Proposals <> wrote:
<complex> is conspicuously missing cbrt(). 

If I put together a proposal to add std::cbrt(std::complex) to <complex>, would there be any interest?

Any thoughts?

Std-Proposals mailing list