Shouldn't this cause an Overflow? It doesn't!

Posted by Cyberherbalist on Stack Overflow See other posts from Stack Overflow or by Cyberherbalist
Published on 2010-05-29T09:13:40Z Indexed on 2010/05/29 9:22 UTC
Read the original article Hit count: 243

Filed under:
|

What's up with this, anyway? I do a simple multiplication:

Int64 x = 11111111111;
Int64 y = 11111111111;
Int64 z = x * y;

And at the end of the multiplication, z shows a value of:

-5670418394979206991

This has clearly overflowed, but no exception is raised. I'd like one to be raised, but...

Note that this is on Windows Phone 7, but I don't think this has any bearing on the issue. Or does it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about windows-phone-7