fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5. long long x = 3037000499ll;
  6. printf("%lld\n", x * x); // 9223372030926249001
  7. printf("%.0lf\n", (double)x * x); // 9223372030926248960
  8. printf("%.0f\n", pow(x, 2)); // 9223372030926248960
  9. printf("%lld\n", (long long)pow(x, 2)); // 9223372030926248960
  10.  
  11. printf("%d\n", pow(x, 2) >= x * x); // 64float compare, true
  12. printf("%d\n", (long long)pow(x, 2) >= x * x); // 64int copmare, false
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 5472KB
stdin
Standard input is empty
stdout
9223372030926249001
9223372030926248960
9223372030926248960
9223372030926248960
1
0