Boost logo

Boost :

From: Matt Borland (matt_at_[hidden])
Date: 2023-04-12 11:29:50


> a) __STDCPP_FLOAT80_T__
> With C++23 we get std::floatN_t-types, which are displayed by the macros __STDCPP_FLOATn_T__. However I miss __STDCPP_FLOAT80_T__, which has its justification/relevance. One could retrofit this
> #if defined(BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE)
> #define __STDCPP_FLOAT80_T__
> namespace std
> {
> using float80_t = boost::float80_t;
> }
> #endif
> Would this be useful/wanted like this?

From the proposal the fixed width types are not allowed to be typedefs of the existing types https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1467r9.html#extended. Sections 5.3 - 5.5 also cover a whole host of conversion rules that would be unsupported. I do not believe this is something we can do at the library level.

> b) complex-functions
> Since C++11 there are the functions abs, asin/h, acos/h, atan/h. These are also defined in boost/math/complex.hpp. But now with 1.82 boost::math is based on C++14, which makes these manual implementations obsolete -> boost/math/complex.hpp can be removed.

These functions are all explicitly marked deprecated, but we do not have a timeline for removal.

> c) constexpr
> I want to upgrade some functions in boost::math. How should/can I handle constexpr there? My problem is:
> - in gcc almost all math functions are constexpr
> - otherwise only some math functions with C++23 are constexpr
> Now it would be suboptimal not to use constexpr just because it is currently not in the standard.
> - If I don't define the additional functions as constexpr or stick strictly to the standard, performance might be wasted, which I don't want.
> - Can I simply define the additional functions with constexpr/BOOST_CXX14_CONSTEXPR? In case of an error there will be the standard-error "not constexpr".

All of the cmath functions that are specified to be constexpr in C++23 can be used with C++17 here: https://github.com/boostorg/math/tree/develop/include/boost/math/ccmath. If you would like to submit PRs for additional functions they are welcome. With the transcendental functions accuracy quickly becomes an issue: https://members.loria.fr/PZimmermann/papers/accuracy.pdf

> d) implementation
> In https://www.boost.org/doc/libs/1_82_0_beta1/libs/math/doc/html/math_toolkit/special_tut/special_tut_impl.html you describe how to implement a new math function. Is this still up to date or is it necessary for simple functions? E.g. cot -> 1/tan.

That is generally correct. If this is for the implementation of constexpr cmath functions I would follow the implementations that can be found in the linked ccmath folder.

Matt


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