powered by
Convert a given decimal constant in the interval (0, 1) to the corresponding binary representation.
DecToBin(x, m = 32, format = "character")
a vector containing the binary representation
a numeric vector of values in the interval (0, 1)
a numeric constant specifying the number of binary digits to use in the output
a character string constant specifying the form of the output
Default format is as a character string. Alternatives are plain which prints results to the device, and vector which output a binary vector.
plain
vector
x <- c(.81, .57, .333) DecToBin(x) # character output DecToBin(x, format="vector") # binary vector output DecToBin(x, format="plain")
Run the code above in your browser using DataLab