Generalised floating point addition: Difference between revisions

m
→‎base 10 only: changed indentation, added whitespace. -- ~~~~
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 /*traipse through the test cases.*/
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 /*traipse through the test cases.*/
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*/