Revision 392ae21a013fb3f518e8f9eb8efb458a55a2eca2 authored by HwB on 09 April 2011, 00:00:00 UTC, committed by Gabor Csardi on 09 April 2011, 00:00:00 UTC
1 parent 162b332
nextpow2.R
###
### NEXTPOW2.R Next higher power of 2
###
nextpow2 <- function(x) {
if (is.null(x) || length(x) == 0) return(c())
if (!is.numeric(x) && !is.complex(x))
stop("Argument 'x' must be a numeric/complex vector/matrix.")
x[x == 0] <- 1
return(ceiling(log2(abs(x))))
}
Computing file changes ...