Advertisement
Guest User

Untitled

a guest
Jan 6th, 2011
807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <cstdio>
  2. #include <cstring>
  3. #include <cassert>
  4.  
  5. #define EPS 1e-9
  6.  
  7. inline int rdn(double x) {
  8.   int y = (int)x + 5;
  9.   while ((double)y > x + EPS) y--;
  10.   return y;
  11. }
  12.  
  13. int main() {
  14.   for (int h = 8388608; h <= 16777216; h <<= 1) {
  15.     double _rw = (double)h / 0.8;
  16.     double _rw_bad = (double)(1 << 24) / 0.8;
  17.     if (!memcmp(&_rw, &_rw_bad, sizeof(double))) {
  18.       printf("%d == %d\n", rdn(_rw), rdn(_rw_bad));
  19.     }
  20.   }
  21.   return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement