Can't even shoot the messenger
-
Edit: where are the fucking discotoasters when you need them
there's one for "someone else already said that"?
never heard of it before.
-
Oh, like IEEE 754 floating point as used just about everywhere?
"Somehow" I forgot to say integer.
-
"Somehow" I forgot to say integer.
May want to say "signed integer", because WTF-pendantry
-
I think that's probably not required. And if there's something with negative zeroes in its unsigned integers, well, that's even stranger.
-
sign+magnitude encoding has negative 0.
IIRC so does ones compliment.
-
IIRC so does ones compliment.
Yes, because with one’s complement you get the opposite of a number by toggling all the bits of the number, so you have positive 0 (
0x0000
) and negative 0 (0x1111
).This doesn’t happen with two’s complement, because with it the opposite of
0x0000
is~0x0000 + 1 = 0x1111 + 1 = 0x0000
.
-
twos compliment does have the odd behavior that 0x1111 = -1
that confused the hell out of me for quite a while.
-
there's one for "someone else already said that"?
I'm just amazed that there isn't one that pops up to suggest in orange tones that I hold off on committing my reply until I've read more of the thread that the fucking toaster has just occluded. It would be as irritating as all fuck. Huge missed opportunity there, @codinghorror.
-
twos compliment does have the odd behavior that 0x1111 = -1
That's actually the design constraint that led to the two's compliment format in the first place. It allows negative numbers to be added without any special treatment - it just overflows the allocated bits and gives the right answer after ignoring the carry flag.
-
oh it's useful and awesome. no doubt about that! still confused the hell out of me
until i realized i was still mentally adding a column for the answer in my head like i would in math where you can always add another digit.
-
oh it's useful and awesome. no doubt about that! still confused the hell out of me
until i realized i was still mentally adding a column for the answer in my head like i would in math where you can always add another digit.
If you want real head scratching, try to figure out how to do it in an infinite-precision arithmetic system. I'll give you a hint: you actually implement those as a sequence of
unsigned int
s (think “32-bit numeral” ) and regard the sign bit as being infinitely distant and copying itself down into all the bits that you haven't explicitly represented yet.
-
I'm just amazed that there isn't one that pops up to suggest in orange tones that I hold off on committing my reply until I've read more of the thread that the fucking toaster has just occluded. It would be as irritating as all fuck. Huge missed opportunity there, @codinghorror.
The solution is clear -- transparent overlay.
-
transparent overlay
Would it be the text or the background of the overlay which is transparent?
-
Obviously both. It looks like nothing's there, but for some reason you can't interact with the site.
Filed under: invisible orange overlays
-
-
-
two's compliment .. allows negative numbers to be added without any special treatment
So does ones complement, using end-around-carry (carry-out of the MSB is carry-in for the LSB). However, an adder like that makes unsigned addition impossible; the MSB of any number is always interpreted as sign.
-
So does ones complement, using end-around-carry (carry-out of the MSB is carry-in for the LSB). However, an adder like that makes unsigned addition impossible; the MSB of any number is <em>always</em> interpreted as sign.
That's "special treatment".
-
Why is the carry from bit N-1 to bit 0 any more special than all the other carries from bits i to i+1?
-
With 2's compliment, you ignore the carry entirely. 25 + (-7) gives 18. The processor will set the carry flag, but it doesn't affect the answer at all.
-
Exactly. With twos complement you have to treat the carry-out from the MSB, and the carry-in to the LSB, differently from those for every other bit in the add. With ones complement, you don't.
-
What processor architecture are you imagining where you don't have a 32 bit add instruction? With 2's complement you literally do nothing other than one single instruction.
-
And on a processor with an end-around-carry adder in the ALU, such as the CDC Cyber series, a signed ones-complement add also takes literally nothing other than one single instruction.
The Cybers, incidentally, don't have a 32-bit add instruction - their native word size is 60 bits (optionally 64 bits on later models).
-
such as the CDC Cyber series
Are there any of those still operating outside of museums?
-
I've not used one for thirty years, and would be surprised to find any still in use for anything other than educational purposes.
-
It is called PR. Having gone through conscription in my country, one would realize that all those stuff that is open to public is PR. Most military organizations have a specialized PR department to cover up matters and to convince the public that they are your allies. In the case of Japan, I would not be surprised that the actual armed departments that is responsible for defending the nation were not present even in the event.