boostorg / math

Boost.org math module
http://boost.org/libs/math
Boost Software License 1.0
308 stars 221 forks source link

promotions #1020

Closed gpeterhoff closed 1 year ago

gpeterhoff commented 1 year ago

Hello, boost/math/toolts/promotion.hpp is corrupt. Unfortunately, I can't say whether some promotions should actually work like this or whether there is an error. Reasons:

boost::math needs C++14 anyway - so I don't understand why legacy C++98/03 is still used.

In order to be able to better illustrate the problems, the behavior of the std::math functions is briefly shown again:

In boost/math/toolts/promotion.hpp there are 3 promotions:

fundamental problem

In detail

I've implemented a few cases promotion.hpp.txt

Of course, I think v4/v5 makes the most sense.

These measures can probably remove promote_args_permissive as well. In general, boost/math/special_functions already included in C++14 can be removed.

1.) template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float> struct promote_args

thx Gero

mborland commented 1 year ago

There is no specialization for std::bfloat16_t because what is the reasonable conversion? I just ran the tests from test_beta_dist with std::bfloat16_t on GCC-13, and they run but are inaccurate as expected. There is discussion at the top of the PR adding support as to our design decisions. PRs with your suggestions are always welcome.