Mercurial > octave-nkf
diff scripts/general/bitget.m @ 17392:e09cd91168d1
Support arguments of class single in bit manipulation functions (bug #34502)
* bitfcns.cc (bitop, Fbitshift): Support arguments of class single.
* bitcmp.m, bitget.m, bitset.m: Support arguments of class single. Add tests.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Sun, 08 Sep 2013 17:55:40 -0400 |
parents | 7d8d194f3f63 |
children | d63878346099 |
line wrap: on
line diff
--- a/scripts/general/bitget.m Sun Sep 08 17:51:23 2013 -0400 +++ b/scripts/general/bitget.m Sun Sep 08 17:55:40 2013 -0400 @@ -41,6 +41,9 @@ if (isa (A, "double")) Amax = ceil (log2 (bitmax)); _conv = @double; + elseif (isa (A, "single")) + Amax = ceil (log2 (bitmax ("single"))); + _conv = @single; else if (isa (A, "uint8")) Amax = 8; @@ -83,6 +86,7 @@ %!test %! assert (bitget ([4, 14], [3, 3]), logical ([1, 1])); +%! assert (bitget (single ([4, 14]), [3, 3]), logical ([1, 1])); %! pfx = {"", "u"}; %! for i = 1:2 %! for prec = [8, 16, 32, 64] @@ -94,6 +98,9 @@ %!error bitget (0, 0) %!error bitget (0, 55) +%!error bitget (single (0), 0) +%!error bitget (single (0), 26) + %!error bitget (int8 (0), 9) %!error bitget (uint8 (0), 9)