I need to round a double to the nearest valid uint64_t
.
So
uint64_t Round(double);
Round(std::numeric_limits<double>::max())==std::numeric_limits<uint64_t>::max();
Round(std::numeric_limits<double>::lowest())==std::numeric_limits<uint64_t>::min();
Round(1.1)==1;
The Round should be equivalent this to but for uint64_t rather than signed integral
auto Round(double d){
std::fesetround(FE_TONEAREST);
return llrint(d);
}
Are there any functions in std && boost to enable this?