Why can't I define 1e18+1 as a global variable?

Revision en1, by Dd2dD2, 2023-03-15 07:39:34

Why does the following code output 1000000000000000000 and not 1000000000000000001?

#include <bits/stdc++.h>
using namespace std;
 
long long inf = 1e18+1;

int main() {
    cout << inf << '\n';
}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Dd2dD2 2023-03-15 07:39:34 273 Initial revision (published)