RosettaCodeData/Task/Long-multiplication/Maple/long-multiplication.maple

13 lines
381 B
Plaintext

longmult := proc(a::integer,b::integer)
local A,B,m,n,i,j;
# Note, return a*b; works in Maple for any sized integer
A := convert(a,base,10);
B := convert(b,base,10);
m := numelems(A);
n := numelems(B);
add( add( A[i]*B[j]*10^(j-1), j=1..n )*10^(i-1), i=1..m );
end;
> longmult( 2^64, 2^64 );
340282366920938463463374607431768211456