Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Value of 1E10 when assigned to an integer is different in intel C++ and visual studio MSVC compiler

pradeep_s_
Beginner
3,541 Views

Hi,

The integer value is different for intel C++ compiler and visual studio MSVC compiler.

The value of 1E10 when assigned to an integer is "1410065408" for MSVC compiler  and whereas for intel C++ is "-2147483648". Could you explain why the value is not same for both the compilers.

Due to this the same code is causing runtime exceptions when compiled through intel C++ compiler. 

Thanks,

Pradeep

 

 

0 Kudos
1 Solution
jimdempseyatthecove
Honored Contributor III
3,541 Views

1E10 is beyond the range of int (32-bit integer). Thus behavior is undefined.

Consider using int64_t integer type for numbers that large.

Jim Dempsey

View solution in original post

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
3,542 Views

1E10 is beyond the range of int (32-bit integer). Thus behavior is undefined.

Consider using int64_t integer type for numbers that large.

Jim Dempsey

0 Kudos
pradeep_s_
Beginner
3,541 Views

Hi Jim Dempsey,

Thank you for the prompt response.

Thanks,

Pradeep

0 Kudos
Reply