Why am I getting unexpected output when using floor with pow?

后端 未结 1 2009
南笙
南笙 2021-01-24 10:12

So, I ran this code on my code blocks:

#include
#include
using namespace std;
int main()
{
    int a;
    a=pow(10,9);
    cout<&         


        
相关标签:
1条回答
  • 2021-01-24 11:07

    Actually, the maximum value for int is 2,147,483,647, therefore there should be no overflow or truncation (it's an int). And my output is exactly:

    1000000000 1000000000 1000000000

    0 讨论(0)
提交回复
热议问题