Below when the number goes negative, I get a large number (4294967290), which is not correct, do anyone know why. I know that Round function returns a double. The large number is 4294967290. What to do see the exact negative number
test4 = (uint)Math.Round((m_abortTime - DateTime.Now,3).TotalSeconds);
Loading
VulpesPosted Jul 3, 2013, 2:35 PM
As a general rule, it's best to avoid the unsigned integral types unless you really need the additional range or you're inter-operating with unmanaged code which uses unsigned types.
Jignesh TrivediPosted Jul 3, 2013, 11:03 PM
hi,
As per my knowledge maximum value is supported by uint is 4294967295, when you trying to assign nagative value or cast nagative value then it perform substraction.
Example:
int j = 0;
uint kkk = (uint)(j - 23232);
interanlly it perform 4294967295 + 0 - 23232 + 1 = 4294944064
this only true for nagative value
hope this will help you.
VulpesPosted Jul 3, 2013, 4:52 PM
David SmithPosted Jul 3, 2013, 3:41 PM
Sanjeeb LenkaPosted Jul 3, 2013, 2:01 PM
The limits for int (32 bit) are:
int: –2147483648 to 2147483647
uint: 0 to 4294967295 And for long (64 bit):
long: -9223372036854775808 to 9223372036854775807
ulong: 0 to 18446744073709551615