View source: R/twos_complement.R
twos_complement | R Documentation |
twos_complement
is vectorised and will convert integers to-and-from
(20-bit) binary form to decode the Two's Complement rule.
twos_complement(x)
x |
Vector of 20-bit integers. |
Numeric vector.
Alexandre Ilha and Stuart K. Grange.
# A hexadecimal number
hex <- "fff4d"
# Hexadecimal as a base 10 decimal
integer <- strtoi(hex, 16)
integer
1048397
# Decode the Two's Complement rule
twos_complement(integer)
-179
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.