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/ ,~ 2x^64</lang>
'''Example:'''
<lang j> longmult ,~ 2x^64
340282366920938463463374607431768211456</lang>
 
'''Alternatives:'''<br>
The above definition may beof writtencourse asbe a single verbaccomplished without the componentsverb definitions:
<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>
892

edits