Since infinity and NaN can't be relied upon, it would be useful to have an easy way to get special values for specific types.
E.g. max value, min value, lowest (smallest positive number, including subnormal), lowest normal number.
Things like max and min are useful as seed values for reductions.
A few ideas:
- Use predeclared names like FLT_MAX, etc like in C. That uses a lot of names.
- Create
@const functions for them, e.g. max<f32>()
- Create a
@const limit function whose first template parameterization is a context-dependent name, e.g.:
limit<max,f32>() is like FLT_MAX
limit<min,f32>() is like FLT_MIN
limit<lowest,f32>() is like C++ std::numeric_limits::lowest<f32>
- Since subnormals might be flushed to zero,
limit<lowest_normal,f32>() could be useful too as a more portable thing
We can't spell abstract types, and we want to keep the ability to expand the range of the abstract numeric types. So consider carefully whether to make this feature for them.