Generalised floating point addition: Difference between revisions
Content added Content deleted
Walterpachl (talk | contribs) m (→base 10 only: typos) |
Walterpachl (talk | contribs) m (→any base: typos) |
||
Line 742: | Line 742: | ||
do j=-7 to 21 /*traipse through the test cases.*/ |
do j=-7 to 21 /*traipse through the test cases.*/ |
||
reps=reps+1 /*increase number of |
reps=reps+1 /*increase number of repetitions.*/ |
||
BCD.j=strip(copies(_123,reps)'^'mult,'L',0) /*construct zoned BCD.*/ |
BCD.j=strip(copies(_123,reps)'^'mult,'L',0) /*construct zoned BCD.*/ |
||
if j//3==0 then BCD.J='+'BCD.j /*add a leading + sign every 3rd#*/ |
if j//3==0 then BCD.J='+'BCD.j /*add a leading + sign every 3rd#*/ |
||
Line 756: | Line 756: | ||
end /*j*/ |
end /*j*/ |
||
say copies('═',maxW) /*display a fence for |
say copies('═',maxW) /*display a fence for separation.*/ |
||
times=81 /*the number of times to add it. */ |
times=81 /*the number of times to add it. */ |
||
Line 790: | Line 790: | ||
if \c then do /*build char str for base ? */ |
if \c then do /*build char str for base ? */ |
||
!=substr($,1+10*(tt<0),t) /*character |
!=substr($,1+10*(tt<0),t) /*character string for base.*/ |
||
if tt<0 then !=0||! /*prefix a zero if neg base.*/ |
if tt<0 then !=0||! /*prefix a zero if neg base.*/ |
||
end |
end |
||
Line 915: | Line 915: | ||
'''output''' is identical to the previous version. |
'''output''' is identical to the previous version. |
||
<br><br> |
<br><br> |
||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
No code, it's built in (uses '*' for multiplication): |
No code, it's built in (uses '*' for multiplication): |