[Gmp-commit] /var/hg/gmp: mini-gmp/tests/t-double.c: Test also mpz_init_set_d.

mercurial at gmplib.org mercurial at gmplib.org
Fri Jan 18 14:41:19 CET 2013


details:   /var/hg/gmp/rev/ecd2c8af8eee
changeset: 15294:ecd2c8af8eee
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Jan 18 14:41:16 2013 +0100
description:
mini-gmp/tests/t-double.c: Test also mpz_init_set_d.

diffstat:

 ChangeLog                 |  1 +
 mini-gmp/tests/t-double.c |  7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 0d119642e9e3 -r ecd2c8af8eee ChangeLog
--- a/ChangeLog	Fri Jan 18 12:06:39 2013 +0100
+++ b/ChangeLog	Fri Jan 18 14:41:16 2013 +0100
@@ -1,6 +1,7 @@
 2013-01-18 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mini-gmp/tests/t-signed.c: Slightly larger coverage.
+	* mini-gmp/tests/t-double.c: Test also mpz_init_set_d.
 
 2013-01-18  Torbjorn Granlund  <tege at gmplib.org>
 
diff -r 0d119642e9e3 -r ecd2c8af8eee mini-gmp/tests/t-double.c
--- a/mini-gmp/tests/t-double.c	Fri Jan 18 12:06:39 2013 +0100
+++ b/mini-gmp/tests/t-double.c	Fri Jan 18 14:41:16 2013 +0100
@@ -63,12 +63,10 @@
 
   hex_random_init ();
 
-  mpz_init (x);
-
   for (i = 0; values[i].s; i++)
     {
       char *s;
-      mpz_set_d (x, values[i].d);
+      mpz_init_set_d (x, values[i].d);
       s = mpz_get_str (NULL, 16, x);
       if (strcmp (s, values[i].s) != 0)
 	{
@@ -80,8 +78,11 @@
 	  abort ();
 	}
       free(s);
+      mpz_clear (x);
     }
 
+  mpz_init (x);
+
   for (i = 0; i < COUNT; i++)
     {
       double d, f;


More information about the gmp-commit mailing list