Long multiplication: Difference between revisions
→{{header|J}}: define verb longmult
(→{{header|J}}: simplify and reorganize) |
(→{{header|J}}: define verb longmult) |
||
Line 647:
buildDecimal=: (+ 10x&*)/@|.
longmult=: buildDecimal@polymult&digits/
'''Example:'''
<lang j> longmult ,~ 2x^64
340282366920938463463374607431768211456</lang>
'''Alternatives:'''<br>
The above
<lang j> (+ 10x&*)/@|.@(+//.@(*/)&(,.&.":))/ ,~2x^64
340282366920938463463374607431768211456</lang>
Or using the primitive dyad <code>#.</code> instead of <code>(+ 10x&*)/@|.</code> :
<lang j> (10x&#.)@(+//.@(*/)&(,.&.":))/ ,~2x^64
340282366920938463463374607431768211456</lang>
|