diff scripts/specfun/pow2.m @ 7385:8b7b4f58199f

[project @ 2008-01-15 20:49:09 by jwe]
author jwe
date Tue, 15 Jan 2008 20:49:10 +0000
parents a1dbe9d80eee
children 95ecf219a582
line wrap: on
line diff
--- a/scripts/specfun/pow2.m
+++ b/scripts/specfun/pow2.m
@@ -56,3 +56,18 @@
   endif
 
 endfunction
+
+%!test
+%! x = [3, 0, -3];
+%! v = [8, 1, .125];
+%! assert(all (abs (pow2 (x) - v) < sqrt (eps)));
+
+%!test
+%! x = [3, 0, -3, 4, 0, -4, 5, 0, -5];
+%! y = [-2, -2, -2, 1, 1, 1, 3, 3, 3];
+%! z = x .* (2 .^ y);
+%! assert(all (abs (pow2 (x,y) - z) < sqrt (eps))
+%! );
+
+%!error pow2();
+