BB said:
The divisor would have to be something smaller than 0 like -2.
Therefore zero is both even and negative.
I seeem to recall 0 coming up negative in some old IBM mainframes.
That was an artifact of the way signed numbers were converted to
binary.
Tam
Not quite, but close. The ones-complement is to convert all zeroes to
one
and all ones to zero.
The twos-complement is the same as the ones-complement but then one is
added.
Thus a negative zero is created by from binary 00000000 to become
11111111 which represents -1. By adding 1, we obtain (1)00000000
and the register, being unable to hold the 9th digit, is said to
overflow,
leaving 00000000.
This is a software matter that is independent of IBM.
When the numbers are fractional, as would be needed for sines
and cosines, etc, the difference between 0.999 and 1.0 is seldom
significant, but the difference between -1 and 0 is a catastrophe.
When I was test engineering for flight simulators, the DC9 sits
on the runway with the nose pitched down by 0.5 degrees. Upon
take off, it passes through zero and the pitch becomes positive.
Exacly a zero degrees, the image flipped upside down and displayed
the runway from the tail, going away, instead of the forward view,
then flipped back to normal. Failing to use the 2's complement
was the cause.
Androcles.