How to convert a binary fraction number into decimal fraction number in R?
问题 I need to write a function that converts a binary fraction number into decimal fraction number in R. e.g. f(0.001) # 0.125 What I did: I searched for the related functions in R packages: DescTools::BinToDec(0.001) # NA DescTools::BinToDec("0.001") # NA base::strtoi(0.001, base=2) # NA base::strtoi("0.001", base=2) # NA base::packBits(intToBits(0.001), "integer") # 0 base::packBits(intToBits("0.001"), "integer") # 0 compositions::unbinary(0.001) # 0.001 compositions::unbinary("0.001") # NA I