Two's complement: Difference between revisions

Content added Content deleted
m (fixed wiki tag)
mNo edit summary
Line 3: Line 3:


[[wp:Two's_complement|Two's complement]] is an important concept in representing negative numbers. To turn a positive integer negative, flip the bits and add one.
[[wp:Two's_complement|Two's complement]] is an important concept in representing negative numbers. To turn a positive integer negative, flip the bits and add one.




;Task
;Task
Show how to calculate the two's complement of an integer. If the technique is different depending on the size of the integer, give an example of each.
Show how to calculate the two's complement of an integer. If the technique is different depending on the size of the integer, give an example of each.



<br></br>


=={{header|Z80 Assembly}}==
=={{header|Z80 Assembly}}==