The following loop would run only when off
which is uint64_t
is less than the value returned by ceil which is double. However I don't see the loop being executed.
#include <bits/stdc++.h>
using namespace std;
int main()
{
uint64_t offset = 1164226701485, size = 945, div = 10000;
for (uint64_t off = offset / div; off < ceil((float)(offset + size) / div); off++)
{
cout<<off;
}
return 0;
}
SO I tried printing those values which seems correct to me and the loop should have been executed atleast once
cout.precision(17);
cout<< offset / div<<" "<< ceil((float)(offset + size) / div);
Output:
116422670 116422672
I am not really sure what's happening here, how can I make the loop to execute?