[Gmp-commit] /var/hg/gmp: 4 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Thu May 17 10:08:52 CEST 2012


details:   /var/hg/gmp/rev/6361979b741d
changeset: 14969:6361979b741d
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu May 17 10:04:07 2012 +0200
description:
Typo.

details:   /var/hg/gmp/rev/e5c9b25d9465
changeset: 14970:e5c9b25d9465
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu May 17 10:05:50 2012 +0200
description:
tests/mpf/reuse.c (dsi_func): Exercise pow_ui. (REMEMBER: not checking correctness!)

details:   /var/hg/gmp/rev/ef10758f04f5
changeset: 14971:ef10758f04f5
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu May 17 10:06:48 2012 +0200
description:
mpf/pow_ui.c: Simplify.

details:   /var/hg/gmp/rev/e47acde3fa1c
changeset: 14972:e47acde3fa1c
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu May 17 10:08:42 2012 +0200
description:
Copyright year.

diffstat:

 ChangeLog         |   5 +++++
 doc/gmp.texi      |   2 +-
 mpf/pow_ui.c      |  12 ++++++------
 tests/mpf/reuse.c |   6 +++---
 tests/mpf/t-eq.c  |   2 +-
 5 files changed, 16 insertions(+), 11 deletions(-)

diffs (97 lines):

diff -r d73d376a7c3d -r e47acde3fa1c ChangeLog
--- a/ChangeLog	Wed May 16 20:17:00 2012 +0200
+++ b/ChangeLog	Thu May 17 10:08:42 2012 +0200
@@ -1,3 +1,8 @@
+2012-05-17 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpf/pow_ui.c: Simplify.
+	* tests/mpf/reuse.c (dsi_func): Exercise pow_ui.
+
 2012-05-16  Torbjorn Granlund  <tege at gmplib.org>
 
 	* tests/mpf/t-eq.c (check_random): New function, meat from old main().
diff -r d73d376a7c3d -r e47acde3fa1c doc/gmp.texi
--- a/doc/gmp.texi	Wed May 16 20:17:00 2012 +0200
+++ b/doc/gmp.texi	Thu May 17 10:08:42 2012 +0200
@@ -4931,7 +4931,7 @@
 Return @math{+1} if @math{@var{op} > 0}, 0 if @math{@var{op} = 0}, and
 @math{-1} if @math{@var{op} < 0}.
 
-This function is actually implemented as a macro.  It evaluates its arguments
+This function is actually implemented as a macro.  It evaluates its argument
 multiple times.
 @end deftypefn
 
diff -r d73d376a7c3d -r e47acde3fa1c mpf/pow_ui.c
--- a/mpf/pow_ui.c	Wed May 16 20:17:00 2012 +0200
+++ b/mpf/pow_ui.c	Thu May 17 10:08:42 2012 +0200
@@ -1,6 +1,6 @@
 /* mpf_pow_ui -- Compute b^e.
 
-Copyright 1998, 1999, 2001 Free Software Foundation, Inc.
+Copyright 1998, 1999, 2001, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -24,18 +24,18 @@
 mpf_pow_ui (mpf_ptr r, mpf_srcptr b, unsigned long int e)
 {
   mpf_t b2;
-  unsigned long int e2;
 
   mpf_init2 (b2, mpf_get_prec (r));
   mpf_set (b2, b);
-  mpf_set_ui (r, 1);
 
   if ((e & 1) != 0)
-    mpf_set (r, b2);
-  for (e2 = e >> 1; e2 != 0; e2 >>= 1)
+    mpf_set (r, b);
+  else
+    mpf_set_ui (r, 1);
+  while (e >>= 1)
     {
       mpf_mul (b2, b2, b2);
-      if ((e2 & 1) != 0)
+      if ((e & 1) != 0)
 	mpf_mul (r, r, b2);
     }
 
diff -r d73d376a7c3d -r e47acde3fa1c tests/mpf/reuse.c
--- a/tests/mpf/reuse.c	Wed May 16 20:17:00 2012 +0200
+++ b/tests/mpf/reuse.c	Thu May 17 10:08:42 2012 +0200
@@ -1,6 +1,6 @@
 /* Test that routines allow reusing a source variable as destination.
 
-Copyright 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1996, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -69,13 +69,13 @@
 dsi_func dsi_funcs[] =
 {
   mpf_div_ui, mpf_add_ui, mpf_mul_ui, mpf_sub_ui,
-  mpf_mul_2exp, mpf_div_2exp
+  mpf_mul_2exp, mpf_div_2exp, mpf_pow_ui
 };
 
 const char *dsi_func_names[] =
 {
   "mpf_div_ui", "mpf_add_ui", "mpf_mul_ui", "mpf_sub_ui",
-  "mpf_mul_2exp", "mpf_div_2exp"
+  "mpf_mul_2exp", "mpf_div_2exp", "mpf_pow_ui"
 };
 
 typedef void (*dis_func) (mpf_ptr, unsigned long int, mpf_srcptr);
diff -r d73d376a7c3d -r e47acde3fa1c tests/mpf/t-eq.c
--- a/tests/mpf/t-eq.c	Wed May 16 20:17:00 2012 +0200
+++ b/tests/mpf/t-eq.c	Thu May 17 10:08:42 2012 +0200
@@ -1,6 +1,6 @@
 /* Test mpf_eq.
 
-Copyright 2009 Free Software Foundation, Inc.
+Copyright 2009, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 


More information about the gmp-commit mailing list