Created by: AMS21
While looking at the code inside xr_types.h
I've notices some very strange definitions which are used later in the code to define constants.
// Type limits
template <typename T>
constexpr auto type_max = std::numeric_limits<T>::max();
template <typename T>
constexpr auto type_min = -std::numeric_limits<T>::max();
template <typename T>
constexpr auto type_zero = std::numeric_limits<T>::min();
type_min
is not the minimum value of integer types it is actually the minimum + 1. This only works for floating point types.
type_zero
is the actual minimum of a type. But is only 0 for unsigned types. For signed types its a negative value.
Thus we have some very strange constants.
constexpr int int_min = type_min<int>; // actually -2147483647 not -2147483648
constexpr int int_zero = type_zero<int>; // actually -2147483648 not 0
...
constexpr float flt_zero = type_zero<float>; // actually 1.175494e-38 not 0.0
...
constexpr double dbl_zero = type_zero<double>; // actually 2.225074e-308 not 0.0
Fixes #195