Advertisement
Guest User

Untitled

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