I need to round a 64-bit double value to the nearest uint64_t in my code with the standard "math.h" midpoint rounding behaviour. Some of these numbers have the property:
- Larger than LLONG_MAX
- Less than or equal to ULLONG_MAX
I noticed there is no 'unsigned' version of the standard library rounding functions. Also, I suspect some of the tricks people use to do this no longer work when an intermediate double value is too large to fit into the mantissa.
What is the best way to do this conversion?