Permalink
Browse files

Tests for cube roots()

git-svn-id: http://svn.pugscode.org/pugs@25974 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
leto
leto committed Mar 23, 2009
1 parent 9ed6d8d commit 20911d4168238abdb6420899e47f812f25cd053c
Showing with 8 additions and 1 deletion.
  1. +8 −1 S32-num/roots.t
View
@@ -1,6 +1,6 @@
use v6;
use Test;
-plan 36;
+plan 40;
# L<S29/Num/"=item roots">
@@ -105,4 +105,11 @@ sub has_approx($n, @list) {
ok(has_approx(exp(log(2)/4 + 1i*pi/8), @l),'exp(log(2)/4 + 1i*pi/8) is a square root of 1+1i');
ok(has_approx(exp(log(2)/4 + 9i*pi/8), @l),'exp(log(2)/4 + 9i*pi/8) is a square root of 1+1i');
}
+{
+ my @l = 8.roots(3);
+ ok(@l.elems == 3, '8.roots(3) returns 3 elements');
+ ok(has_approx(2,@l), '2 is a cube root of 8');
+ ok(has_approx(exp(1/3*(log(8) + 2i*pi)),@l), 'exp(1/3*(log(8) + 2i*pi)) is a cube root of 8');
+ ok(has_approx(exp(1/3*(log(8) + 4i*pi)),@l), 'exp(1/3*(log(8) + 4i*pi)) is a cube root of 8');
+}

0 comments on commit 20911d4

Please sign in to comment.