Boost logo

Boost :

From: Gero Peterhoff (g.peterhoff_at_[hidden])
Date: 2022-08-13 11:09:37




Am 13.08.22 um 10:12 schrieb John Maddock via Boost:
> On 10/08/2022 21:17, Gero Peterhoff via Boost wrote:
>> Am 10.08.22 um 20:23 schrieb John Maddock via Boost:
>>> On 10/08/2022 18:09, Gero Peterhoff via Boost wrote:
>>>> Hello,
>>>> I would like to add several missing math functions in boost or specialize/overload existing ones for more types.
>>> Which functions?
>> 1) scalar types
>> - isdenormal
>
> OK
>
>> - trigonometric cot/sec/csc, acot/asec/acsc, acoth/asech/acsch, acot2(like atan2) -> the problem is not the implementation as such, but a standardized error handling
> Yep, I have wondered about those in the past.
>> - abs/div for unsigned types -> useful/need in templates
> Yep.  I had to add an "unsigned_abs" function to multiprecision to handle generic abs calls.
>> - inv
>> - sgn (support nan/inf, ±0)
> boost::math::sign should do what you want already.
>> - rounding https://en.wikipedia.org/wiki/Rounding#Comparison_of_approaches_for_rounding_to_an_integer
> Almost a library in it's own right ;)  But OK.
>>
>> 2) std::complex
>> - complete all std-functions for complex
>> - complete all special-functions for complex
>
> That's a heck of a lot of work - certainly to get them reliable.
>
> Do you want to make a start with some PR's for the low-hanging fruit?
>
Yes, that's why I asked which C++ standard can be used. Can I use e.g.
- concepts
- lambdas
- constexpr if
?
Best, Gero

> Best, John.
>
>>
>> for the future
>>
>> 3) complex types
>> - dual numbers https://en.wikipedia.org/wiki/Dual_number
>> - split-complex numbers https://en.wikipedia.org/wiki/Split-complex_number
>>
>> 4) logic
>> - a modern constexpr implementation for tribool -> bool3
>> - bool4 https://en.wikipedia.org/wiki/Four-valued_logic
>>
>> Best, Gero
>>
>>>> These should be constexpr if possible.
>>>>
>>>> My problems with the concrete implementations are:
>>>> - Which C++ standard to use C++11/14/17/20/23 ?
>>>> - Should these be implemented in ccmath and math ?
>>>>    a) ccmath requires C++17 (eg "if constexpr"), so it is not possible to simply call the ccmath version in math, since math requires C++11.
>>>
>>> Maybe, but we have announced a move to C++14, and in any case new additions can use whatever std version they require, as long as that requirement is documented and actually needed (ie not just using cool new features "just because").
>>>
>>> I do note however, that the constexpr function may not be as efficient *at runtime* as they could be due to the need not to use compiler intrinsics / std lib functions and such (so they should probably be marked as consteval in C++20).  So yes, possibly two versions.  But it depends what the functions are?
>>>
>>> Best, John.
>>>
>>>>    b) On the other hand, the math functions are already included in the standard (since C++11), so it wouldn't be necessary to continue to provide them (especially since they are not constexpr).
>>>>
>>>> Where and how exactly and with which C++ standard can I add the functions ?
>>>>
>>>> thx
>>>> Gero
>>>>
>>>> _______________________________________________
>>>> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>>>
>>>
>>>
>>> _______________________________________________
>>> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>>
>>
>> _______________________________________________
>> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk