Two's complement: Difference between revisions

m
Line 541:
</pre>
=={{header|Ruby}}==
Ruby integers have has a built-in 'one-complement'method: '''~''', which flips all bits. Adding 1 leads to a negative integer:
<syntaxhighlight lang="ruby">~42 + 1 # => -42
</syntaxhighlight>
 
=={{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,149

edits