I recommend ?sprintf (4^(1/3))^3 != 4 (4^(1/3))^3 == 4 (4^(1/3))^3 - 4 format(c((4^(1/3))^3 , 4), digits=17) sprintf("%+13.13a", c((4^(1/3))^3 , 4))
On Fri, Dec 13, 2013 at 10:11 PM, 水静流深 <1248283...@qq.com> wrote: > i have write a function to convert decimal number into binary number in R. > > dectobin<-function(x){ > as.numeric(intToBits(x))->x1 > paste(x1,collapse="")->x2 > as.numeric(gsub("0+$","",x2))->x3 > return(as.character(x3))} > > dectobin can get right result ,it is so long ,is there a build-in function > to do ? > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.