Re: R-alpha: R 0.12 alpha: problem with qt() -- PATCH for 0.13

Peter Dalgaard BSA (pd@kubism.ku.dk)
07 Nov 1996 16:15:29 +0100


To: R-testers@stat.math.ethz.ch
Subject: Re: R-alpha: R 0.12 alpha: problem with qt() -- PATCH for 0.13
From: Peter Dalgaard BSA <pd@kubism.ku.dk>
Date: 07 Nov 1996 16:15:29 +0100
In-Reply-To: Douglas Bates's message of Wed, 6 Nov 96 14:21 CST
Message-Id: <x2hgn2q6lq.fsf_-_@bush.kubism.ku.dk>


The patch for .12 wouldn't take on .13 due to some minor reformatting.
This one works better, I hope.

$ diff -u R{-orig,}/src/math/qbeta.c 
--- R-orig/src/math/qbeta.c     Tue Oct 29 22:30:06 1996
+++ R/src/math/qbeta.c  Thu Nov  7 16:07:06 1996
@@ -26,30 +26,32 @@
 
 #include "Mathlib.h"
 
-static double zero = 0.0;
-static double half = 0.5;
-static double one = 1.0;
-static double two = 2.0;
-static double three = 3.0;
-static double four = 4.0;
-static double five = 5.0;
-static double six = 6.0;
-static double nine = 9.0;
+#define zero 0.0
+#define half 0.5
+#define one 1.0
+#define two 2.0
+#define three 3.0
+#define four 4.0
+#define five 5.0
+#define six 6.0
+#define nine 9.0
 
 /* set the exponent of accu to -2r-2 for r digits of accuracy */
-static double acu = 1.0e-32;
-static double lower = 0.0001;
-static double upper = 0.9999;
-static double const1 = 2.30753;
-static double const2 = 0.27061;
-static double const3 = 0.99229;
-static double const4 = 0.04481;
+#define acu 1.0e-32
+#define lower 0.0001
+#define upper 0.9999
+#define const1 2.30753
+#define const2 0.27061
+#define const3 0.99229
+#define const4 0.04481
+
+static volatile double trunc;
 
 double qbeta(double alpha, double p, double q)
 {
        int index;
        double a, adj, beta, g, h, pp, prev, qq, r, s, sq, t, tx, w, y, yprev;
-       double xinbta;
+       volatile double xinbta;
 
        /* define accuracy and initialize */
 
@@ -145,7 +147,9 @@
                        }
                        g = g / three;
                }
-               if (tx == xinbta)
+               trunc = tx; /* this prevents trouble with excess FPU
+                               precision on some machines. */
+               if (trunc == xinbta)
                        goto L10;
                xinbta = tx;
                yprev = y;


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-