Unexpected output of a very simple program

using namespace std;

int main()

return 0;


out put-2000000000000000000

Please format your code - the forum software has mangled it and it won’t compile! :slight_smile:

1 Like



pow() function return double type ans if you do double - integer so the result is double which is then converted into integer. Now the problem is that double has precision problem. So if you are dealing with large numbers, please use powl() instead of pow() and powl() will return long double type which whill solve your problem. And also is you wanna type 9999999999999999, please type LL at the end of it, like this 9999999999999999LL.