Two's complement: Difference between revisions

(Added Forth entry)
Line 306:
0b000000000000000001011000100110000111101010001001001010011</pre>
 
=={{header|RPL}}==
RPL can handle integers whose size can be set from 1 to 64 bits. For this task, a 8-bit size is selected with <code>STWS</code>.
RPL considers 'true' integers (i.e. declared by the prefix <code>#</code>) to be positive, so the two's complement can not be done by the <code>NEG</code> instruction.
8 STWS BIN
#3d NOT 1 +
{{out}}
<pre>
1: #11111101b
</pre>
=={{header|Wren}}==
Strictly speaking, Wren doesn't have integers. Instead all numbers are 'IEEE 754' 64 bit floating point values (their underlying C type being ''double'') and negative numbers are therefore represented using the ''offset binary'' method rather than ''two's complement''.
1,150

edits