Mercurial > hg > octave-lyh
diff scripts/general/nextpow2.m @ 2816:ad4bf2a82b4f
[project @ 1997-03-15 21:08:25 by jwe]
author | jwe |
---|---|
date | Sat, 15 Mar 1997 21:08:32 +0000 |
parents | 1dca28c213f0 |
children | 6923abb04e16 |
line wrap: on
line diff
--- a/scripts/general/nextpow2.m +++ b/scripts/general/nextpow2.m @@ -31,11 +31,14 @@ usage ("nextpow2 (x)"); endif - if (is_vector (x)) - x = length (x); - elseif (! is_scalar (x)) + if (! (is_scalar (x) || is_vector (x))) error ("nextpow2: x must be a scalar or a vector"); endif + + t = length (x); + if (t > 1) + x = t; + endif [f, n] = log2 (abs (x)); if (f == 0.5)