Two's complement: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
|||
Line 219: | Line 219: | ||
2147483646 -> -2147483646 |
2147483646 -> -2147483646 |
||
2147483647 -> -2147483647 |
2147483647 -> -2147483647 |
||
</pre> |
|||
=={{header|XPL0}}== |
|||
<lang XPL0>int I; char C; |
|||
[I:= 123; |
|||
I:= (~I) + 1; |
|||
IntOut(0, I); CrLf(0); |
|||
C:= -123; |
|||
C:= ~(C-1); |
|||
IntOut(0, C); CrLf(0); |
|||
]</lang> |
|||
{{out}} |
|||
<pre> |
|||
-123 |
|||
123 |
|||
</pre> |
</pre> |
||