On Tue, Oct 25, 2022 at 12:30 PM Jason C <jason.cipriani@gmail.com> wrote:

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

Although... this then implies that the roots are ordered, and I'm pretty sure there's no predictable and consistent way to ensure some order of the returned roots given that there's no solid definition of ordering for complex number combined with realistic fp precision errors.

I'm starting to think maybe my idea wasn't such a good one after all and this is probably too complicated to make its way into std; users would be better off choosing other implementations that meet their specific needs, probably.

Jason

On Tue, Oct 25, 2022 at 11:48 AM Dejan Milosavljevic <dmilos@gmail.com> 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 <std-proposals@lists.isocpp.org> 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?Jason

Std-Proposals mailing list

Std-Proposals@lists.isocpp.org

https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals