Displaying 2 results from an estimated 2 matches for "intbin".
Did you mean:
incbin
2004 Feb 05
2
(no subject)
Hello,
Splus contains the function intbin(x,l).
This function allows to make a conversion from an integer x to a binary of
length l.
for example
intbin(3,2) returns 11
intbin(3,3) returns 011
Do you know how to do it in R ?
Thank you meriema
2004 Feb 06
1
0.1 + 0.2 != 0.3 revisited
Prompted by Peter Dalgard's recent elegant "intbin" function,
I have been playing with the extension to converting reals to binary
representation. The decimal part can be done like this:
decbase <- function(x, n=52, base=2) {
if(n) {
x <- x*base
paste(trunc(x), decbase(x%%1, n-1, base), sep="")
}
}
n=52 default be...