A negative zero is related to the way the number is stored in binary expression, and not some real achievable result from a mathematical calculation.
In floating point storage, the topmost bit is often used to indicate a sign. This gives 31 bits for data (in a 32-bit floating point value), so there are actually two representations for zero.
00000000 00000000 00000000 00000000
Or
00000000 00000000 00000000 00000001
Both represent zero, but one with a sign set to negative.
Naturally, this usually happens when you increase the maximum possible positive number, it overflows to a negative zero.
In .net, however, I think that by default the type does overflow checks and throws an exception rather than allowing you to overflow, so the only way to really archive this value is to set it directly. In addition, -0 must always be compared with +0.
This is said more on Wikipeida.
Simon p stevens
source share