C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::cbrt(std::complex)

From: Jason C <jason.cipriani_at_[hidden]>
Date: Tue, 25 Oct 2022 12:30:49 -0400
Perhaps

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 <dmilos_at_[hidden]>
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_at_[hidden]> 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_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>

Received on 2022-10-25 16:31:18