diff scripts/general/bitset.m @ 17391:7d8d194f3f63

bitget.m, bitset.m: Make max bit index consistent * bitget.m, bitset.m: Compute maximum bit index consistently.
author Mike Miller <mtmiller@ieee.org>
date Sun, 08 Sep 2013 17:51:23 -0400
parents d4b4080faa47
children e09cd91168d1
line wrap: on
line diff
--- a/scripts/general/bitset.m	Sun Sep 08 17:28:05 2013 -0400
+++ b/scripts/general/bitset.m	Sun Sep 08 17:51:23 2013 -0400
@@ -54,10 +54,10 @@
 
   if (isfloat (A) && isreal (A))
     Bmax = bitmax (cl);
-    Amax = log2 (Bmax);
+    Amax = ceil (log2 (Bmax));
   elseif (isinteger (A))
     Bmax = intmax (cl);
-    Amax = round (log2 (Bmax));
+    Amax = ceil (log2 (Bmax));
   else
     error ("bitset: invalid class %s", cl);
   endif