Advertisement
Guest User

Untitled

a guest
May 30th, 2011
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include<cstdio>
  2. #include<cmath>
  3. int main()
  4. {
  5.    double a, b;
  6.    long double A, B;
  7.    
  8.    a = 1; b = 3;
  9.    A = 1; B = 3;
  10.    
  11.    a /= b;
  12.    A /= B;
  13.    
  14.    B = a; // double > long double
  15.    int res;
  16.    res = A==B;
  17.    
  18.    printf("Comparing d & ld: %d\n", res);
  19.    
  20.    b = A; // long double > double
  21.    res = a==b;
  22.    printf("Comparing d & d:  %d\n", res);
  23.    
  24.    double diff = A-a;
  25.    printf("%.50lf\n", diff);
  26.    return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement