No, I specifically used Rexx where I can set the numeric digits to any significance I want. I had the Pi program already, and I just fed the answer to the SQRT function that is a part of the PI program. I have compared the output to published lists of Pi digits, and it is accurate. I think that the differences beyond 1000 digits of Pi are too small to show up in the calculation of the square root at that point.
Here is the program:
/* Square root of Pi to digits places/2 */
parse arg places
numeric digits places /* Number of places for PI calculation */
number_pi=PI(places)
sroot=sqrt(number_pi,places/2) /* half the number for the square root */
lineout("sroot.txt",sroot) /* Output to file for cutting and pasting */
exit
PI: procedure
parse arg P
if P = "" then P = 9; P=P+3; numeric digits P
X = SQRT(2, P); Pi = 2 + X; Y = SQRT(X, P); X = Y
do forever
X = 0.5 * (X + 1 / X)
NewPi = Pi * (X + 1) / (Y + 1)
if Pi = NewPi then return trunc(Pi,P-3)
Pi = NewPi
X = SQRT(X, P)
Y = (Y * X + 1 / X) / (Y + 1)
end
SQRT: procedure
parse arg N, P
if P = "" then P = 9; numeric digits P
parse value FORMAT(N,,,,0) with N "E" Exp
if Exp = "" then Exp = 0
if (Exp // 2) <> 0 then
if Exp > 0 then do; N = N * 10; Exp = Exp - 1; end
else do; N = N / 10; Exp = Exp + 1; end
X = 0.5 * (N + 1)
do forever
NewX = 0.5 * (X + N / X)
if X = NewX then return X * 10 ** (Exp % 2)
X = NewX
end
It was supposed to log a bunch of measurements, do Chi-square stuff, and then tell them when it was time to retool.
It was taking and logging the measurements to 6 places, but then they were turning out big batches of rejects - and it wasn't ever popping up any flags to retool.
He determined that while the actual measuring device was accurate and functioning, the cheeseball computer (Probably a 286), that came with it was rounding all those super precise numbers, and then butchering up the math with even more rounding in the statistical analysis process.
He ended up selling them a clone system, and writing them a program that did something like you did to keep the extra places.