Commit 52bb535ff77285646af89faa5d7c9f893b8a909f

Steffen Jaeckel 2014-02-14T12:53:48

demo: test both mp_n_root() implementations

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/demo/demo.c b/demo/demo.c
index 37dba51..78e0903 100644
--- a/demo/demo.c
+++ b/demo/demo.c
@@ -179,8 +179,13 @@ printf("compare no compare!\n"); return EXIT_FAILURE; }
 	 printf("\nmp_sqrt() error!");
 	 return EXIT_FAILURE;
       }
-      mp_n_root(&a, 2, &a);
-      if (mp_cmp_mag(&b, &a) != MP_EQ) {
+      mp_n_root_ex(&a, 2, &c, 0);
+      mp_n_root_ex(&a, 2, &d, 1);
+      if (mp_cmp_mag(&c, &d) != MP_EQ) {
+	 printf("\nmp_n_root_ex() bad result!");
+	 return EXIT_FAILURE;
+      }
+      if (mp_cmp_mag(&b, &c) != MP_EQ) {
 	 printf("mp_sqrt() bad result!\n");
 	 return 1;
       }