Description: 大整数乘法例子代码
/* 递归边界,如果是1位二进制数与1位二进制数相乘,则可以直接计算 */
/*累计做1位二进制乘法运算的次数*/
/* return (X*Y) */
/* 计算n的值 */
/* 把X和Y拆分开来,令X=A*2^(n/2)+B, 左移位运算,mod = 1<<(n/2) */
/* 计算XY=AC*2^n+(AD+CB)*2^(n/2)+BD */
/* 计算A*C,再向左移n位 */
/* 递归计算A*D */
/* 递归计算C*B */
/* 计算a21+a22,再向左移n/2位 */
/* 递归计算B*D */
/* XY=a1+a2+a3 */
-large integer multiplication example code / * Recursive border, if it is a binary number with a binary number multiplication, can be directly calculated * / / * the beginning of a binary multiplication of the number * / / * return (X * Y) * / / * calculate the value of n * / / * X and Y to split it so that X = A * 2 ^ (n / 2) B, the left shift operator, mod = 1LT; lt; (n / 2) * / / * calculate XY = AC * 2 ^ n (AD CB) * 2 ^ (n / 2) BD * / / * A * C calculation, further n-bits * / / * recursive computation A * D * / / * recursive calculation of C * B * / / * Calculation A21 A22 and then bits n / 2 * / / * recursive calculation B * D * / / * XY = a1 a2 a3 * / Platform: |
Size: 1532 |
Author:小城 |
Hits:
Description: 大整数乘法例子代码
/* 递归边界,如果是1位二进制数与1位二进制数相乘,则可以直接计算 */
/*累计做1位二进制乘法运算的次数*/
/* return (X*Y) */
/* 计算n的值 */
/* 把X和Y拆分开来,令X=A*2^(n/2)+B, 左移位运算,mod = 1<<(n/2) */
/* 计算XY=AC*2^n+(AD+CB)*2^(n/2)+BD */
/* 计算A*C,再向左移n位 */
/* 递归计算A*D */
/* 递归计算C*B */
/* 计算a21+a22,再向左移n/2位 */
/* 递归计算B*D */
/* XY=a1+a2+a3 */
-large integer multiplication example code/* Recursive border, if it is a binary number with a binary number multiplication, can be directly calculated*//* the beginning of a binary multiplication of the number*//* return (X* Y)*//* calculate the value of n*//* X and Y to split it so that X = A* 2 ^ (n/2) B, the left shift operator, mod = 1LT; lt; (n/2)*//* calculate XY = AC* 2 ^ n (AD CB)* 2 ^ (n/2) BD*//* A* C calculation, further n-bits*//* recursive computation A* D*//* recursive calculation of C* B*//* Calculation A21 A22 and then bits n/2*//* recursive calculation B* D*//* XY = a1 a2 a3* / Platform: |
Size: 1024 |
Author:小城 |
Hits:
Description: 使用分治技术,实现的两个大整数的乘法运算-The use of sub-rule technology, the realization of two big integer multiplication Platform: |
Size: 814080 |
Author:wangkc |
Hits: