I have a shamefully naive question: What is the best way to convert a uint32_t to a double between 0 and 1?
My naive way is
double myconvert(uint32_t a)
{
double n = static_cast<double>(std::numeric_limits<uint32_t>::max() - std::numeric_limits<uint32_t>::min());
return static_cast<double>(a) / n;
}
But I was wondering if there is a better way?