# Re: R-alpha: R 0.12 alpha: problem with qt()

Peter Dalgaard BSA (pd@kubism.ku.dk)
07 Nov 1996 11:55:27 +0100

```To: R-testers@stat.math.ethz.ch
Subject: Re: R-alpha: R 0.12 alpha: problem with qt()
From: Peter Dalgaard BSA <pd@kubism.ku.dk>
Date: 07 Nov 1996 11:55:27 +0100
In-Reply-To: Douglas Bates's message of Wed, 6 Nov 96 14:21 CST
Message-Id: <x2iv7iqin4.fsf@bush.kubism.ku.dk>

This patch seems to fix things. I took the liberty of also fixing the
mysterious static double constants (declaring them const double didn't
help much - the compiler isn't smart enough to realize that e.g. "fldl zero"
is replaceable by "fldz" when the value of zero is 0.0).

\$ diff -u R{-orig,}/src/math/qbeta.c
--- R-orig/src/math/qbeta.c     Tue Jul  2 01:08:59 1996
+++ R/src/math/qbeta.c  Thu Nov  7 11:44:03 1996
@@ -26,31 +26,33 @@

#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 */

@@ -143,7 +145,8 @@
}
g = g / three;
}
-               if (tx == xinbta)
+               trunc = tx;
+               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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
```