bin2dec | R Documentation |
The function bin2dec
Converts binary representations to digital numbers (e.g., 10101011 = 171). Fractions, (e.g., 0.11101) will be evaluated to the number of bits provided. The function will not handle codification of whole numbers with fractional parts. The function dec2bin
Converts decimal representations to binary and can handle whole numbers, fractional, and numbers with both whole and fractional parts.
bin2dec(digits, round = 4)
dec2bin(num, max.bits = 10, max.rep0 = 6)
digits |
A string of binary digits. |
round |
Rounding for fractional results, defaults to 4. |
num |
A decimal number. |
max.bits |
The maximum number of bits to be used to approximate fractional numbers. |
max.rep0 |
A handler for meaningless repeating zeroes at the end of some binary representations of decimal numbers, e.g., 0.25. Can be turned off by letting |
If a decimal number with fractional, or both whole and fractional parts is provided to dec2bin
, a vector with seperate binary expressions for each of these components is returned.
Ken Aho
bin2dec(1011001101) #=717
dec2bin(717)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.