.NET Overflows, Java Doesnt

markc

Newcomer
Joined
Mar 19, 2006
Messages
6
int x = 2000000000 * 2000000000; in java gives -1651507200

in vb, the same yields an overflow, and
Code:
math.bigmul(2000000000 * 2000000000 ) yields 4000000000000000000

ive learned that this is because java simply drops the higher order bits in order to fit it into the integer type

my question is, how do i accomplish the same in .NET? Im transfering some code over and I was wondering if there was anything in the framework that does it

thanks
 
In VB.Net, the only control for whether or not integer overflow checking is enabled (as far as I know) is to set it in the project's properties (or using the /removeintchecks switch if you are using the command line). This will effect every integer operation in the assembly though.
 
Back
Top