Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
241 Views

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

Jump to solution

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

Accepted Solutions
Highlighted
241 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
Highlighted
242 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
Highlighted
Beginner
241 Views

Hi Jim Dempsey,

Thank you for the prompt response.

Thanks,

Pradeep

0 Kudos