Anonymous user
Generalised floating point addition: Difference between revisions
Generalised floating point addition (view source)
Revision as of 06:02, 19 October 2012
, 11 years ago→base 10 only: changed indentation, added whitespace. -- ~~~~
Walterpachl (talk | contribs) m (→any base: removed an empty line that caused a TSO hickup) |
m (→base 10 only: changed indentation, added whitespace. -- ~~~~) |
||
Line 583:
===base 10 only===
<lang rexx>/*REXX pgm to perform generalized floating point addition using BCD nums*/
/*┌────────────────────────────────────────────────────────────────────┐
┌─┘ This REXX program uses an uncompressed (or zoned) BCD which └─┐
Line 602 ⟶ 601:
└─┐ The number of digits for the precision is automatically adjusted. ┌─┘
└────────────────────────────────────────────────────────────────────┘*/
maxW=200-1 /*max width allowed for displays.*/
/*ideally: maxW=linesize()-1 */
Line 610 ⟶ 608:
say left('── ────── ─',maxW,'─') /*hdr sep*/
do j=-7 to 21
reps=reps+1 /*increase number of repititions.*/
BCD.j=strip(copies(_123,reps)'^'mult,'L',0) /*construct zoned BCD.*/
Line 628 ⟶ 626:
times=81 /*the number of times to add it. */
do k=-7 to 21
parse var BCD.k mantissa '^' exponent /*decompose the zoned BCD num.*/
x=mantissa'e'exponent /*reconstitute the original num. */
Line 706 ⟶ 704:
21 sum=1e+72
</pre>
===any base===
<lang rexx>/*REXX pgm to perform generalized floating point addition using BCD nums*/
|