All
Congratulations to Steve Comstock
with http://www.trainersfriend.com/
for posting first solution to problem #13 using 5 packed decimal instructions.
See the source and generated output here:
http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm
Some follow-up questions and
comments after reading all the posts today regarding the ZMFACC contest on the http://www.listserv.uga.edu/archives/asm370.html:
1. In response to the question about the purpose
of the contest and the trade-off between fewest instructions, fastest
execution, least memory, and ease of maintenance, I have updated the web site
to say the primary goals are to have some fun and learn more about mainframe
assembler. Hopefully in the process folks will also share what they think
makes for maintainable assembler code. Certainly I agree that when
writing assembler code for a project where the code will live on indefinitely
and probably be maintained by someone else, the first priority may well be
making the code as understandable and portable as possible including such
things as defining the derivation and limits of any constants, avoiding tricks
which may be machine dependant and may make future upgrades and/or porting to
other languages much more difficult.
2. In response to the statement that floating point
should not be used in the solution to this problem, I have a question.
What method of rounding is “correct” for this problem? In
Steve’s packed decimal solution he only used 1 extra decimal place to
determine rounding. Using the new packed decimal instructions, it is possible
to use any number of “extra” digits to perform rounding up to 34
digits using the 128 bit extended format. If additional digits are
included and there is a carry into the 2 decimal digits required, the result is
different. Perhaps one of the most common methods for performing this
function is using a COBOL statement like DIVIDE TOTAL-PRICE BY QUANTITY GIVING
UNIT-PRICE ROUNDED. What kind of code does this generate and does the
COBOL standard say exactly how many extra digits or bits will be used in
performing the rounding. I can remember in my distant past, having issues
with this sort of thing when simply upgrading from one COBOL compiler version
to another on the same machine let along switching between platforms with
different hardware and software. If I am reading this document correctly
it would appear that the COBOL “Standard” calls for using 128 bit
decimal floating point to handle ROUNDED in a way that is portable across
machines and compilers: http://www.cobolstandard.info/j4/files/05-0063.doc
Don Higgins
mailto:don@...
http://don.higgins.net