diff -Naurd mpfr-2.3.0-a/PATCHES mpfr-2.3.0-b/PATCHES
--- mpfr-2.3.0-a/PATCHES	2007-08-29 10:18:11.000000000 +0000
+++ mpfr-2.3.0-b/PATCHES	2007-09-03 00:03:46.000000000 +0000
@@ -0,0 +1 @@
+mpfr_acosh
diff -Naurd mpfr-2.3.0-a/VERSION mpfr-2.3.0-b/VERSION
--- mpfr-2.3.0-a/VERSION	2007-09-02 23:55:55.000000000 +0000
+++ mpfr-2.3.0-b/VERSION	2007-09-03 00:02:12.000000000 +0000
@@ -1 +1 @@
-2.3.0-p1
+2.3.0-p2
diff -Naurd mpfr-2.3.0-a/acosh.c mpfr-2.3.0-b/acosh.c
--- mpfr-2.3.0-a/acosh.c	2007-08-29 10:18:11.000000000 +0000
+++ mpfr-2.3.0-b/acosh.c	2007-08-31 17:20:08.000000000 +0000
@@ -73,7 +73,7 @@
     /* Declaration of the size variables */
     mp_prec_t Ny = MPFR_PREC(y);   /* Precision of output variable */
     mp_prec_t Nt;                  /* Precision of the intermediary variable */
-    mp_exp_t  err, exp_te, exp_ti; /* Precision of error */
+    mp_exp_t  err, exp_te, d;      /* Precision of error */
     MPFR_ZIV_DECL (loop);
 
     /* compute the precision of intermediary variable */
@@ -91,13 +91,35 @@
         mpfr_mul (t, x, x, GMP_RNDD);      /* x^2 */
         exp_te = MPFR_GET_EXP (t);
         mpfr_sub_ui (t, t, 1, GMP_RNDD);   /* x^2-1 */
-        exp_ti = MPFR_GET_EXP (t);
-        mpfr_sqrt (t, t, GMP_RNDN);        /* sqrt(x^2-1) */
-        mpfr_add (t, t, x, GMP_RNDN);      /* sqrt(x^2-1)+x */
-        mpfr_log (t, t, GMP_RNDN);         /* ln(sqrt(x^2-1)+x)*/
+        if (MPFR_UNLIKELY (MPFR_IS_ZERO (t)))
+          {
+            mpfr_t z;
+
+            /* This means that x is very close to 1: x = 1 + z with
+               z < 2^(-Nt). Instead of increasing the precision, let's
+               compute x^2-1 by (x+1)(x-1) with an accuracy of about
+               Nt bits. */
+            mpfr_init2 (z, Nt);
+            mpfr_add_ui (t, x, 1, GMP_RNDD);
+            mpfr_sub_ui (z, x, 1, GMP_RNDD);
+            mpfr_mul (t, t, z, GMP_RNDD);
+            d = 2;
+            mpfr_sqrt (t, t, GMP_RNDN);        /* sqrt(x^2-1) */
+            mpfr_add (t, t, z, GMP_RNDN);      /* sqrt(x^2-1)+z */
+            mpfr_clear (z);
+            mpfr_log1p (t, t, GMP_RNDN);       /* log1p(sqrt(x^2-1)+z) */
+          }
+        else
+          {
+            d = exp_te - MPFR_GET_EXP (t);
+            d = MAX (1, d);
+            mpfr_sqrt (t, t, GMP_RNDN);        /* sqrt(x^2-1) */
+            mpfr_add (t, t, x, GMP_RNDN);      /* sqrt(x^2-1)+x */
+            mpfr_log (t, t, GMP_RNDN);         /* ln(sqrt(x^2-1)+x) */
+          }
 
         /* error estimate -- see algorithms.tex */
-        err = 3 + MAX (1, exp_te - exp_ti) - MPFR_GET_EXP(t);
+        err = 3 + d - MPFR_GET_EXP (t);
         /* error is bounded by 1/2 + 2^err <= 2^(1+max(-1,err)) */
         err = 1 + MAX (-1, err);
         if (MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - err, Ny, rnd_mode)))
@@ -117,9 +139,3 @@
   MPFR_SAVE_EXPO_FREE (expo);
   return mpfr_check_range (y, inexact, rnd_mode);
 }
-
-
-
-
-
-
diff -Naurd mpfr-2.3.0-a/mpfr.h mpfr-2.3.0-b/mpfr.h
--- mpfr-2.3.0-a/mpfr.h	2007-09-02 23:55:55.000000000 +0000
+++ mpfr-2.3.0-b/mpfr.h	2007-09-03 00:02:12.000000000 +0000
@@ -27,7 +27,7 @@
 #define MPFR_VERSION_MAJOR 2
 #define MPFR_VERSION_MINOR 3
 #define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "2.3.0-p1"
+#define MPFR_VERSION_STRING "2.3.0-p2"
 
 /* Macros dealing with MPFR VERSION */
 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-2.3.0-a/tests/tacosh.c mpfr-2.3.0-b/tests/tacosh.c
--- mpfr-2.3.0-a/tests/tacosh.c	2007-08-29 10:18:10.000000000 +0000
+++ mpfr-2.3.0-b/tests/tacosh.c	2007-08-31 17:20:00.000000000 +0000
@@ -123,12 +123,40 @@
   mpfr_clear (y);
 }
 
+/* With MPFR 2.3.0, this yields an assertion failure in mpfr_acosh. */
+static void
+bug20070831 (void)
+{
+  mpfr_t x, y, z;
+  int inex;
+
+  mpfr_init2 (x, 256);
+  mpfr_init2 (y, 32);
+  mpfr_init2 (z, 32);
+  mpfr_set_ui (x, 1, GMP_RNDN);
+  mpfr_nextabove (x);
+  inex = mpfr_acosh (y, x, GMP_RNDZ);
+  mpfr_set_ui_2exp (z, 1, -127, GMP_RNDN);
+  mpfr_nextbelow (z);
+  MPFR_ASSERTN (inex < 0);
+  if (!mpfr_equal_p (y, z))
+    {
+      printf ("Error in bug20070831:\nexpected ");
+      mpfr_dump (z);
+      printf ("got      ");
+      mpfr_dump (y);
+      exit (1);
+    }
+  mpfr_clears (x, y, z, (void *) 0);
+}
+
 int
 main (int argc, char *argv[])
 {
   tests_start_mpfr ();
 
   special ();
+  bug20070831 ();
 
   test_generic (2, 100, 25);
 
diff -Naurd mpfr-2.3.0-a/version.c mpfr-2.3.0-b/version.c
--- mpfr-2.3.0-a/version.c	2007-09-02 23:55:55.000000000 +0000
+++ mpfr-2.3.0-b/version.c	2007-09-03 00:02:12.000000000 +0000
@@ -25,5 +25,5 @@
 const char *
 mpfr_get_version (void)
 {
-  return "2.3.0-p1";
+  return "2.3.0-p2";
 }
