Index: src/nmath/pgamma.c
===================================================================
--- src/nmath/pgamma.c	(revision 48409)
+++ src/nmath/pgamma.c	(working copy)
@@ -231,7 +231,11 @@
  */
 double logspace_sub (double logx, double logy)
 {
-    return logx + log1p (-exp (logy - logx));
+    register double diff = logy - logx ;
+
+    return diff < 0.1 
+        ? logx + log (-expm1 (diff))
+        : logx + log1p (-exp (diff));
 }
 
 
