Date: Tue, 25 Oct 2022 12:40:29 -0400
On Tue, Oct 25, 2022 at 12:30 PM Jason C <jason.cipriani_at_[hidden]> wrote:
> Perhaps
>
> template <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_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
>>>
>>
> Perhaps
>
> template <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_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:40:57