Re:Arithmetic in Computer Hardware
by adgjlsfhk1 on Friday November 17, 2023 @01:19AM
(#38300196)
imo the best way to explain 2s compliment is via a diversion through 2-adic numbers. that also lets you explain the really fun trick where you can store multiplicative inverses within the integers.
[ Parent
| on HN ]
Re:Arithmetic in Computer Hardware
by nh23423fefe on Friday November 17, 2023 @03:41PM
(#38309894)
I dunno if its "best" when compared to just regular old Z_(2^32)
Re:Arithmetic in Computer Hardware
by adgjlsfhk1 on Friday November 17, 2023 @07:49PM
(#38313243)
Z_(2^32) is a really good explanation for unsigned integers, but to me at least it's not a great explanation of why signed integers are the way they are.
Re:Arithmetic in Computer Hardware
by nh23423fefe on Monday November 20, 2023 @01:42PM
(#38352396)
But the justification is the same, congruence modulo 2^n
Z_4
0 1 2 3 4 5 6 7 8 9
0 1 2 3 0 1 2 3 0 1
0 1 -2 -1 0 1 -2 -1 0 1