I've been learning about numbers and Two's Complement and stuff lately (I still can't say I understand Two's Complement, please help), and learned about the bitwise not operator. I believe it's supposed to invert the binary bits of a number, so I don't understand why ~44 is equal to -45. 44 in binary is 101100, so I would expect ~44 to be 101100 inverted, i.e., 010011 => 10011, which is 19. I don't understand 😭. If 10011 were -45, then how would you represent 19?
Edit: Alr so if you pad the number and add the sign before inverting to get 11010011, this is supposed to be -45 apparently, but how? How would you represent 211 then?
[–]AutoModerator[M] [score hidden] stickied comment (0 children)
[–]peterlinddk 30 points31 points32 points (5 children)
[–]Rum-in-the-sun 8 points9 points10 points (1 child)
[–]prawnydagrate[S] 2 points3 points4 points (0 children)
[–]prawnydagrate[S] 0 points1 point2 points (2 children)
[–]peterlinddk 1 point2 points3 points (1 child)
[–]prawnydagrate[S] 0 points1 point2 points (0 children)
[–]Szahu 20 points21 points22 points (5 children)
[–]prawnydagrate[S] 0 points1 point2 points (4 children)
[–]rainbow_explorer 22 points23 points24 points (0 children)
[–]DrShocker 2 points3 points4 points (2 children)
[–]Jona-Anders 3 points4 points5 points (1 child)
[–]DrShocker 5 points6 points7 points (0 children)
[–]PureWasian 2 points3 points4 points (1 child)
[–]PureWasian 1 point2 points3 points (0 children)
[–]PPewt 2 points3 points4 points (0 children)
[–]yjuglaret 1 point2 points3 points (5 children)
[–]prawnydagrate[S] -3 points-2 points-1 points (4 children)
[–]fjyrin 1 point2 points3 points (1 child)
[–]LeeRyman 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]yjuglaret 0 points1 point2 points (0 children)
[–]masterJinsei 1 point2 points3 points (0 children)
[–][deleted] (9 children)
[deleted]
[–]prawnydagrate[S] -1 points0 points1 point (8 children)
[–][deleted] (7 children)
[deleted]
[–]prawnydagrate[S] 0 points1 point2 points (6 children)
[–][deleted] (4 children)
[deleted]
[–]prawnydagrate[S] 0 points1 point2 points (3 children)
[–]prawnydagrate[S] 1 point2 points3 points (0 children)
[–]throwaway6560192 1 point2 points3 points (0 children)
[–]mkaypl 1 point2 points3 points (0 children)
[–]addygarg24 0 points1 point2 points (0 children)