Metropoli BBS
VIEWER: mul.txt MODE: TEXT (ASCII)
a # 1 60 R ' c#a mul b                                                  '
a # a,[1]  '"multiprecision integer multiply                            '
a # a,[1]  '"make a the shorter of the arguments to save space          '
a # a,[1]  ' $((Ra)=(Ra#fix a)DRb#fix b)/l1                             '
a # a,[1]  ' c#a                                                        '
a # a,[1]  ' a#b                                                        '
a # a,[1]  ' b#c                                                        '
a # a,[1]  '"check for possible overflow (720 = (2*56)%1e7*2).          '
a # a,[1]  'l1:$(720>1YRc#aJ.Xb)/l2                                     '
a # a,[1]  ' c#((Dc%10000000),0)+0,10000000|c                           '
a # a,[1]  'l2:c#can+`/(Lio_IRa)`Oc,((Ra),-1+Ra)R0                      '
a # a,[1]  ' $0                                                         '
a # a,[1]  '"mul - multiprecision integer multiplication                '
a # a,[1]  '"from ''the apl handbook of techniques'' copyright 1978, ibm. '
a # a,[1]  '"-a is multiplied by b, giving c, using multiprecision      '
a # a,[1]  '" integer arithmetic; a and b may be in any numeric format  '
a # a,[1]  '"-see the description under Gadd                            '
a # a,[1]  '"-uses: Gfix Gcan                                           '
Lfx a
[ RETURN TO DIRECTORY ]