mattkretz / wg21-papers

my papers to WG21 — the C++ committee
5 stars 7 forks source link

masked hmin and hmax should support infinities #68

Open mattkretz opened 6 years ago

mattkretz commented 6 years ago

The current specification works fine for finite values. But if a user expects hmin/hmax to give correct results when infinities may be in the input, then the current specification makes this impossible to implement efficiently.

Suggested fix:

template<class T, class V>
typename V::value_type hmin(const const_where_expression<M, V>& x);

Returns: If none_of(x.mask), the return value is numeric_limits<V::value_type>::max()infinity().

template<class T, class V>
typename V::value_type hmax(const const_where_expression<M, V>& x);

Returns: If none_of(x.mask), the return value is -numeric_limits<V::value_type>::lowest()infinity().