Long multiplication: Difference between revisions
Content added Content deleted
m (→{{header|Quackery}}: teensy tweak) |
(→{{header|Quackery}}: aded) |
||
Line 4,768: | Line 4,768: | ||
In addition to the specified task, we were always encouraged to show our workings. |
In addition to the specified task, we were always encouraged to show our workings. |
||
<lang Quackery> |
<lang Quackery>( ------------- preamble to task, some i/o related words ------------- ) |
||
[ [] swap witheach |
|||
[ char 0 - |
[ char 0 - |
||
swap join ] ] is $->long ( $ --> L ) |
swap join ] ] is $->long ( $ --> L ) |
||
Line 4,781: | Line 4,783: | ||
witheach echo ] is echolong ( L --> ) |
witheach echo ] is echolong ( L --> ) |
||
( ------------------------- task starts here ------------------------- ) |
|||
[ over size |
|||
over size - |
|||
dup dip |
|||
[ 0 < if swap ] |
|||
⚫ | |||
⚫ | |||
[ [ table |
[ [ table |
||
Line 4,803: | Line 4,800: | ||
[ dip add add dip [ add nip ] swap ] is addc ( n n c --> n c ) |
[ dip add add dip [ add nip ] swap ] is addc ( n n c --> n c ) |
||
[ |
[ over size |
||
over size - |
|||
dup dip |
|||
[ |
[ 0 < if swap ] |
||
⚫ | |||
⚫ | |||
[ zeropad ( when adding to numbers of different lengths, ) |
|||
0 temp put ( leading zeroes are added to make the lengths ) |
|||
[] unrot witheach ( equal. This is implicit when the calculation ) |
|||
[ dip behead ( done by hand, and is done by zeropad here. ) |
|||
temp take |
temp take |
||
addc |
addc |
||
Line 4,853: | Line 4,857: | ||
timesten ] |
timesten ] |
||
drop ] is longmult ( L L --> L ) |
drop ] is longmult ( L L --> L ) |
||
( ------------------------ additional to task ------------------------ ) |
( ------------------------ additional to task ------------------------ ) |