Martin
Thanks, after SHARE I'll take a run at optimizing the SQXTR routine. The
emulator pz390.java code for the SQXBR and SQXR routines actually uses Math
library square root function to start with 64 bit square root guess which
then only requires a couple of iterations to get to 128 bit square root
solution. It sounds like I can improve these as well by skipping
unnecessary iteration and unrolling the code.
Don Higgins
mailto:don@...
http://don.higgins.net
-----Original Message-----
From: z390-assembler-contest@yahoogroups.com
[mailto:z390-assembler-contest@yahoogroups.com] On Behalf Of Martin Ward
Sent: Saturday, February 23, 2008 4:47 AM
To: z390-assembler-contest@yahoogroups.com
Subject: Re: [z390-assembler-contest] ZMFACC z390 Mainframe Assembler Coding
Contest Update 02/22/08 - 5 new solutions and 1 new problem
On Saturday 23 Feb 2008 02:05, Don Higgins wrote:
> 4. I've posted 2 additional solutions for problem 12 calculation of
> standard deviation. Now there are 3 solutions; one using BFP, one using
> HFP, and one using just DFP instructions. The DFP solution proved to be
> more challenging than expected as the latest POP (at least for today) is
> missing the opcode SQXTR corresponding to the existing SQXBR and SQXR used
> in the other solutions. As a result I have coded a substitute SQXTR macro
> which calls standalone SQXTR CSECT which uses DFP instructions to perform
> the square root function using Newton Raphson method. For the current
> problem it converged to 34 digit solution in 7 iterations. Suggestions
for
> improving the first guess will help. Note all 3 solutions produce the
same
> result to 33+ decimal places.
This web page:
http://www.mactech.com/articles/mactech/Vol.14/14.01/FastSquareRootCalc/
describes how to use a table to obtain a more accurate first approximation.
Given that the first approximation has a known maximum error, it should be
possible to compute the maximum number of iterations required to
guarantee convergance. This saves an iteration, since the final iteration
is there just to prove convergance (the result does not improve on the final
iteration). Given that the number of iterations is fixed (and small!),
you can also fully unroll the loop.
--
Martin
martin@... http://www.cse.dmu.ac.uk/~mward/ Erdos number: 4
G.K.Chesterton web site: http://www.cse.dmu.ac.uk/~mward/gkc/
Yahoo! Groups Links