bfloat16 ctor using float argument being not constexpr is limitating
Describe the feature you would like to be implemented.
To date, the bfloat16 ctor taking float argument is not constexpr and is calling float_to_bfloat16_rtne<false>
.
BTW, float_to_bfloat16_rtne is a not constexpr function too so I don't really understand how the other ctor
template <class T>
explicit constexpr bfloat16(const T &val)
can be constexpr itself (isn't that a bug ?).
Would such a feature be useful for other users? Why?
It seems quite an important feature that ctor for bfloat using a float argument is constexpr. I guess things like
static constexpr bfloat16 bf{1.f/600.f};
will be usefull to others ?
Any hints on how to implement the requested feature?
A constexpr version of float_to_bfloat16_rtne
must be given, or at least of float_to_bfloat16_rtne<true>
(this should be ok even with the static_cast inside I think) but this will require a constexpr bit_cast ...
Additional resources
Edited by tryingsomestuff